3v4l.org

run code in 500+ PHP versions simultaneously
<?php function my_callback( $value, $one, $two, $three ) { echo "Params passed to callback:\n"; print_r( compact( 'value', 'one', 'two', 'three' ) ); return strtoupper( $value ); } function apply_filters( $hook_name, $value, ...$args ) { echo "Params passed to apply_filters():\n"; print_r( compact( 'hook_name', 'value', 'args' ) ); $value = call_user_func_array( 'my_callback', array_values(array( $value, ...$args ) ) ); return $value; } $args = [ 'three' => 3, 'two' => 2, 'one' => 1, ]; $value = call_user_func_array( 'apply_filters', array_merge( array( 'foo', 'bar' ), $args ) ); echo "value: $value\n";
Output for rfc.property-hooks, git.master_jit, git.master
Params passed to apply_filters(): Array ( [hook_name] => foo [value] => bar [args] => Array ( [three] => 3 [two] => 2 [one] => 1 ) ) Params passed to callback: Array ( [value] => bar [one] => 3 [two] => 2 [three] => 1 ) value: BAR

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:
58.68 ms | 2829 KiB | 4 Q