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