3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/plain'); function test($a, $b) { echo var_export($a, 1) . ' == ' . var_export($b, 1) . ' => ' . var_export($a == $b, 1) . "\n"; } test( null, '' ); // true test( null, array() ); // true test( '', array() ); // false test( 'true', true ); // true test( 'false', false ); // false test( 'false', true ); // true test( 9, '09' ); // true test( 9, 09 ); // false test( '0E4', 09 ); // true test( '0x00', '0E4' ); // true test( '0x0.1', 0 ); // true test( 'x', 0 ); // true test( '0xabcabcabcabcabc', '0XABCABCABCABCABd' ); // true test( array('1'), array('0x1') ); // true test( array(1) + array(2), array(1) ); // true test( function(){}, new stdclass() ); // true test( `foo`, `bar` ); // true
Output for 5.4.43 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
NULL == '' => true NULL == array ( ) => true '' == array ( ) => false 'true' == true => true 'false' == false => false 'false' == true => true 9 == '09' => true 9 == 0 => false '0E4' == 0 => true '0x00' == '0E4' => true '0x0.1' == 0 => true 'x' == 0 => true '0xabcabcabcabcabc' == '0XABCABCABCABCABd' => false array ( 0 => '1', ) == array ( 0 => '0x1', ) => true array ( 0 => 1, ) == array ( 0 => 1, ) => true Closure::__set_state(array( )) == stdClass::__set_state(array( )) => false NULL == NULL => true
Output for 5.3.29, 5.4.25 - 5.4.42
NULL == '' => true NULL == array ( ) => true '' == array ( ) => false 'true' == true => true 'false' == false => false 'false' == true => true 9 == '09' => true 9 == 0 => false '0E4' == 0 => true '0x00' == '0E4' => true '0x0.1' == 0 => true 'x' == 0 => true '0xabcabcabcabcabc' == '0XABCABCABCABCABd' => false array ( 0 => '1', ) == array ( 0 => '0x1', ) => true array ( 0 => 1, ) == array ( 0 => 1, ) => true Closure::__set_state(array( )) == stdClass::__set_state(array( )) => false NULL == NULL => true sh: 1: foo: not found sh: 1: bar: not found
Output for 4.3.0
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/Lbb3K on line 22
Process exited with code 255.

preferences:
184.25 ms | 1394 KiB | 56 Q