3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $inputs = array(NULL, 0, 1, 1.1, '1.1'); foreach ($inputs as $input) { $output = key(array($input => NULL)); printf("Input: %s\n", var_export($input, TRUE)); printf("Output: %s\n\n", var_export($output, TRUE)); }
Output for 4.4.1, 5.1.0 - 5.4.21, hhvm-3.12.0, 7.1.0
Input: NULL Output: '' Input: 0 Output: 0 Input: 1 Output: 1 Input: 1.1 Output: 1 Input: '1.1' Output: '1.1'
Output for 5.6.28, 7.0.14
Input: NULL Output: '' Input: 0 Output: 0 Input: 1 Output: 1 Input: 1.1000000000000001 Output: 1 Input: '1.1' Output: '1.1'
Output for 5.4.38 - 5.6.21, 7.0.0 - 7.0.6
Input: NULL Output: '' Input: 0 Output: 0 Input: 1 Output: 1 Input: 1.10000000000000008881784 Output: 1 Input: '1.1' Output: '1.1'
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.4.22 - 5.4.37
Input: NULL Output: '' Input: 0 Output: 0 Input: 1 Output: 1 Input: 1.100000000000000088817841970012523233890533447265625 Output: 1 Input: '1.1' Output: '1.1'
Output for 4.3.2 - 4.4.0, 4.4.2 - 5.0.5
Fatal error: Only variables can be passed by reference in /in/taXU1 on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Only variables can be passed by reference in /in/taXU1 on line 4