3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo '$formData = array();'; echo "\n"; $formData = array(); echo 'empty($formData[chain_id]): '; var_dump(empty($formData['chain_id'])); echo "\n"; echo '$formData[chain_id] === \'0\': '; var_dump($formData['chain_id'] === '0'); echo "\n"; echo "\n"; echo '$formData[\'chain_id\'] = 0;'; echo "\n"; $formData['chain_id'] = 0; echo 'empty($formData[chain_id]): '; var_dump(empty($formData['chain_id'])); echo "\n"; echo '$formData[chain_id] === \'0\': '; var_dump($formData['chain_id'] === '0'); echo "\n"; echo "\n"; echo '$formData[\'chain_id\'] = 1;'; echo "\n"; $formData['chain_id'] = 1; echo 'empty($formData[chain_id]): '; var_dump(empty($formData['chain_id'])); echo "\n"; echo '$formData[chain_id] === \'0\': '; var_dump($formData['chain_id'] === '0'); echo "\n"; echo "\n";
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
$formData = array(); empty($formData[chain_id]): bool(true) $formData[chain_id] === '0': Notice: Undefined index: chain_id in /in/lEdfT on line 10 bool(false) $formData['chain_id'] = 0; empty($formData[chain_id]): bool(true) $formData[chain_id] === '0': bool(false) $formData['chain_id'] = 1; empty($formData[chain_id]): bool(false) $formData[chain_id] === '0': bool(false)
Output for 4.3.0 - 5.2.17
$formData = array(); empty($formData[chain_id]): bool(true) $formData[chain_id] === '0': Notice: Undefined index: chain_id in /in/lEdfT on line 10 bool(false) $formData['chain_id'] = 0; empty($formData[chain_id]): bool(true) $formData[chain_id] === '0': bool(false) $formData['chain_id'] = 1; empty($formData[chain_id]): bool(false) $formData[chain_id] === '0': bool(false)