- var_dump: documentation ( source)
<?php
function compare_behaviour($arg1, $arg2) {
static $test = 0;
++$test;
$res1 = ($arg1 ?: $arg2);
$res2 = ($arg1 or $arg2);
if( $res1 === $res2 ){
echo "$test\n========\n";
var_dump($arg1, $arg2, $res1, $res2);
}
}
compare_behaviour(false, true);
compare_behaviour(0, 1);
compare_behaviour(0, 0);
compare_behaviour(NULL, []);