3v4l.org

run code in 500+ PHP versions simultaneously
<?php $code = 'return $arg;'; echo "Test 1: "; $fn = create_function('$arg', $code); echo $fn('foo'); echo "\n\n"; echo "Test 2: "; $fn = function($arg) use($code) { eval($code); }; echo $fn('bar'); echo "\n\n"; echo "Test 3: "; $fn = function($arg) use($code) { return eval($code); }; echo $fn('baz');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
Test 1: Fatal error: Uncaught Error: Call to undefined function create_function() in /in/689VZ:6 Stack trace: #0 {main} thrown in /in/689VZ on line 6
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Test 1: Deprecated: Function create_function() is deprecated in /in/689VZ on line 6 foo Test 2: Test 3: baz
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.3.32 - 7.3.33
Test 1: foo Test 2: Test 3: baz

preferences:
109.71 ms | 2002 KiB | 4 Q