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:
- PHP – Failed to open stream : No such file or directory
- Working with large numbers in PHP
- Unicode character in PHP string
- Using PHP 5.5’s password_hash and password_verify function
- Is there a way to use shell_exec without waiting for the command to complete?
- How can I get the error message for the mail() function?
- How do I prevent mails sent through PHP mail() from going to spam? [duplicate]
- I need my PHP page to show my BLOB image from mysql database
- How to get JavaScript variable value in PHP
- How can I properly use a PDO object for a parameterized SELECT query
- How to insert multiple rows from a single query using eloquent/fluent
- Converting HTML to plain text in PHP for e-mail
- Continue PHP execution after sending HTTP response
- Is micro-optimization worth the time?
- PHP __get and __set magic methods
- PHP: Convert unicode codepoint to UTF-8
- Redefine Built in PHP Functions
- Best way to completely destroy a session – even if the browser is not closed
- How can I generate a screenshot of a webpage using a server-side script?
- Can’t access global variable inside function
- How to get everything after a certain character?
- PHP UPDATE prepared statement
- How do i run PHP inside CSS
- How to find the dates between two specified date?
- PHP Array to CSV
- Difference between array_map, array_walk and array_filter
- Geo-Search (Distance) in PHP/MySQL (Performance)
- How can I fix the Permission error when I call session_start()?
- How do I immediately execute an anonymous function in PHP?
- Warning: mysqli_query() expects parameter 1 to be mysqli, resource given [duplicate]
- variable variables
- dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related
- Convert all types of smart quotes with PHP
- How to create a PSR-4 autoloader for my project?
- Can’t pass mysqli connection in session in php
- PHP new line break in emails
- Installing PHP Zip Extension
- Get next element in foreach loop
- MongoDB: Fatal error: Class ‘MongoClient’ not found
- Reverse array in php
- php share variable among different users/sessions
- PHP on Windows with XAMPP running 100 times too slow
- MySQLi prepared statements with IN operator [duplicate]
- How to execute raw queries with Laravel 5.1?
- Correct indentation of HTML and PHP using Vim
- How to compare two time in PHP
- mysql count into PHP variable
- How to reverse order output of a MySQL query
- Laravel migrations: Class “not found”
- Can I trust PHP __destruct() method to be called?