The callback
syntax is a little odd in PHP. What you need to do is make an array. The 1st element is the object, and the 2nd is the method.
call_user_func(array($player, 'SayHi'));
You can also do it without call_user_func
:
$player->{'SayHi'}();
Or:
$method = 'SayHi';
$player->$method();
Related Contents:
- How can I capture the result of var_dump to a string?
- How can I perform static code analysis in PHP? [closed]
- How can I parse a JSON file with PHP? [duplicate]
- Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
- PHP – how to best determine if the current invocation is from CLI or web server?
- Weird PHP error: ‘Can’t use function return value in write context’
- Laravel 5.5 ajax call 419 (unknown status)
- How to zip a whole folder using PHP
- Remove excess whitespace from within a string
- Cannot create cache directory .. or directory is not writable. Proceeding without cache in Laravel
- Tell Composer to use Different PHP Version
- How to prevent Browser cache for php site
- Why is require_once so bad to use?
- What is the difference between MySQL, MySQLi and PDO? [closed]
- How to check whether mod_rewrite is enable on server?
- Difference between dependency injection and dependency inversion
- Use PHP to create, edit and delete crontab jobs?
- Submitting a multidimensional array via POST with php
- PHP Thread Safe and Non-Thread Safe for Windows
- How to do error logging in CodeIgniter (PHP)
- PHP shorthand for isset()? [duplicate]
- Verify ImageMagick installation
- How to hash long passwords (>72 characters) with blowfish
- Laravel: Error [PDOException]: Could not Find Driver in PostgreSQL
- PHP – define constant inside a class
- How to implement a bitmask in php?
- What is the name and location of the Nginx config file (htaccess equivalent)?
- Switch from PHP 7.2 to 7.1 on Ubuntu 16.04, Apache
- Remove a part of a string, but only when it is at the end of the string
- php – Should I call exit() after calling Location: header?
- What does a PHP function return by default?
- PHP: Split string into array, like explode with no delimiter
- Laravel firstOrNew how to check if it’s first or new?
- Laravel: Difference App::bind and App::singleton
- How to start a foreach loop at a specific index in PHP
- How to test a second parameter in a PHPUnit mock object
- How can I use HTML tags in a Laravel localization file?
- How can I generate a HmacSHA256 signature of a string
- PHP Find all occurrences of a substring in a string
- Access PHP var from external javascript file
- Is it recommended to store PHP Sessions in MemCache?
- How to create multilingual translated routes in Laravel
- php imagecopyresized vs imagecopyresampled vs imagecopy pros/cons
- PHP Class Constants – Public, Private or Protected?
- Reading line by line from STDIN
- Why Xampp control panel shows an error access denied upon launch [closed]
- When is it good to use pass by reference in PHP?
- What is 22527 in error_reporting 22527 of phpinfo
- NGINX: connect() to unix:/var/run/php7.0-fpm.sock failed (2: No such file or directory)
- MySQL Performance – “IN” Clause vs. Equals (=) for a Single Value [duplicate]