Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sgupta1979's avatar

Laravel 10 error - Call to undefined function numberize_amount()

I am getting below error in blade file of Laravel Call to undefined function numberize_amount()

Code is as below {{ numberize_amount((float) $data['total'])}}

Please guide

0 likes
5 replies
LaryAI's avatar
Level 58

The error message "Call to undefined function numberize_amount()" suggests that the function "numberize_amount()" is not defined or not accessible in your Laravel application.

To resolve this issue, you need to make sure that the "numberize_amount()" function is defined and accessible in your codebase. Here are a few steps you can follow:

  1. Check if the function is defined:

    • Open your Laravel project and navigate to the file where the function is supposed to be defined.
    • Look for a function named "numberize_amount()". Make sure it is defined correctly and has the expected functionality.
  2. Check the function's accessibility:

    • If the function is defined in a separate file, make sure that file is included or autoloaded properly in your Laravel application.
    • If the function is defined within a class, make sure the class is imported or autoloaded correctly.
  3. Clear the Laravel cache:

    • Sometimes, Laravel's cache can cause issues with function accessibility. Run the following command to clear the cache:
      php artisan cache:clear
      
  4. Check for any typos or naming inconsistencies:

    • Double-check the spelling and capitalization of the function name in both the calling code and the function definition.
    • Ensure that the function name is consistent throughout your codebase.

If you have followed these steps and the issue persists, please provide more information about the function's location and how it is defined, so that I can assist you further.

sgupta1979's avatar

@LaryAI

method is defined in one of the helper like below

function numberize_amount($number) { return number_format($number); }

I checked evertthing as metioned above. Everything is fine.

tykus's avatar

@sgupta1979 your helper functions file should be autoloaded; in composer.json, e.g.

{
    // ...
    "autoload": {
        "files": [
            "app/helpers.php"
        ],
        "psr-4": {
			// ...
        }
    },

and run composer dump-autoload on the CLI

However, as @snapey mentions, this is a BS helper function as it simply wrapping the existing number_format

tykus's avatar

This was probably a custom helper function that was defined in whatever application you copied the Blade template from.

Snapey's avatar

you created a function that calls a single function?

change your code

{{ number_format($data['total]') }}

Please or to participate in this conversation.