For versions prior to PHP 7, the only way to execute them immediately I can think of is
call_user_func(function() { echo 'executed'; });
With current versions of PHP, you can just do
(function() { echo 'executed'; })();
More Related Contents:
- How to get JavaScript function data into a PHP variable
- Javascript and PHP functions
- How can you use php in a javascript function [duplicate]
- Calling a function on click of button in HTML/PHP [closed]
- How do I pass JavaScript variables to PHP?
- Call php function from JavaScript
- AngularJS HTTP post to PHP and undefined
- How can I call PHP functions by JavaScript?
- How to get the jQuery $.ajax error response text?
- What is the difference between a language construct and a “built-in” function in PHP?
- Send array with Ajax to PHP script
- How can I get the user’s local time instead of the server’s time?
- How to pass data from Javascript to PHP and vice versa? [duplicate]
- Detect exact OS version from browser
- How to put php inside JavaScript?
- Send PHP date to JavaScript date format
- Use a variable to define a PHP function
- jQuery AJAX form using mail() PHP script sends email, but POST data from HTML form is undefined
- How to access PHP session variables from jQuery function in a .js file?
- Function list of php file
- Why are PHP function calls *so* expensive?
- Is there a JavaScript way to do file_get_contents()?
- Jquery ajax setTimeout after form succes not redirecting?
- Undefined variable problem with PHP function
- Modify a globally scoped variable inside of an anonymous function
- Pass a PHP variable to a JavaScript variable
- json parse error with double quotes
- Cannot redeclare function php [duplicate]
- PHP get all arguments as array?
- Is it possible to detect a visitor’s browsing history using JavaScript or PHP?