3v4l.org

run code in 300+ PHP versions simultaneously
<?php $anon = function($arg1, $arg2 = 2) { var_dump($this->mine, $arg1, $arg2); }; class Me { protected $mine = 8; } $me = new Me; $args = [4, 2]; // This is ugly, and doesn't take a variable number of args $anon->call($me, $args[0], $args[1]); // This doesn't exist =( // $anon->apply($me, $args); // We took .bind() and .call() from JS, why not .apply()? // This is ugly too, but takes a variable number of args call_user_func_array(array($anon, 'call'), array_merge(array($me), $args));
Output for git.master, git.master_jit, rfc.property-hooks
int(8) int(4) int(2) int(8) int(4) int(2)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
49.22 ms | 401 KiB | 8 Q