3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(string $a) {} // Calling internal function that uses standard ZPP try { random_bytes([]); } catch(TypeError $e) { echo $e->getMessage() . "\n"; } // Calling internal function that uses custom ZPP try { min(""); } catch(TypeError $e) { echo $e->getMessage() . "\n"; } // Calling user-land function try { foo([]); } catch(TypeError $e) { echo $e->getMessage() . "\n"; }
Output for 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
random_bytes() expects parameter 1 to be int, array given Warning: min(): When only one parameter is given, it must be an array in /in/IRXq6 on line 14 Argument 1 passed to foo() must be of the type string, array given, called in /in/IRXq6 on line 21
Output for 7.2.0 - 7.2.26
random_bytes() expects parameter 1 to be integer, array given Warning: min(): When only one parameter is given, it must be an array in /in/IRXq6 on line 14 Argument 1 passed to foo() must be of the type string, array given, called in /in/IRXq6 on line 21

preferences:
52.76 ms | 407 KiB | 5 Q