<pre><?php print "\n";
function prhead($spc){
print "\n".str_pad('$a',$spc-1,' ',STR_PAD_BOTH).'VS.'.str_pad('$b',$spc-1,' ',STR_PAD_BOTH).' ';
print '$a>$b'." ".'$a<$b'." ".'$a<=$b'." ".'$a>=$b'." ".'$a==$b'." ".'$a===$b'." \n";
}
function prline($item,$spc){
print str_pad($item['typea'].'('.$item['vala'].')',$spc,' ',STR_PAD_BOTH).' ';
print str_pad($item['typeb'].'('.$item['valb'].')',$spc,' ',STR_PAD_BOTH);
unset($item['typea']);unset($item['typeb']);unset($item['vala']);unset($item['valb']);
foreach ($item as $i) print ' '.str_pad($i,5,' ',STR_PAD_LEFT);
print " \n";
}
$wh=array('boolean','string','double','integer');
$to=array('bool','str','float','int');
$cleanup=array("'' . "," . ''","\n",'array ()');
$q=array(NAN,INF,-INF,NULL,'',array(),'true','text',TRUE,1,1e0,'1',FALSE,'false','-','+',chr(0),0,'0',0e0,-1,-1e0,'-01','-001','01','001');
//$q=array("015","0015","-015","-0015",15,"15","-15",'-',-15,'15e0','15e2',1500,15e0,15e2);
//$q=array('A','a','ax','abc');
//Scientific `e` notation is of type `float`, not integer (no mater if too 'small') !
//Integers going over `PHP_INT_MAX` get automatically converted to `float`
//Floats going over system's boundaries have `INF` value
//Undefined variables are of type and value `NULL`
//Integers preceded by `0` are converted from octal do decimal (on assignment)
//Converting Strings containing an integer with a leading `0` TO integer strips the leading `0`
//Fun string comparison: 'Queen' > 'King' > 'Jack' > 'Ace'
$res=array();$crazy=array();$equality=array();$ltgt=array();$compatible=array();
$types=array();$vals=array();
foreach ($q as $a) {
foreach ($q as $b) {
$item=array();
$typea=str_replace($wh,$to,gettype($a));$types[$typea]=strlen($typea);
$vala=str_replace($cleanup,'',var_export($a,true));
$vals[$vala]=strlen($vala);
$typeb=str_replace($wh,$to,gettype($b));$types[$typeb]=strlen($typeb);
$valb=str_replace($cleanup,'',var_export($b,true));
$vals[$valb]=strlen($valb);
//if (($typea!=$typeb)||($vala!=$valb)){
$item['gt']=var_export($a>$b,true);
$item['lt']=var_export($a<$b,true);
$item['lte']=var_export($a<=$b,true);
$item['gte']=var_export($a>=$b,true);
$item['eq']=var_export($a==$b,true);
$item['eqs']=var_export($a===$b,true);
$same=$item;
$item['typea']=$typea;
$item['typeb']=$typeb;
$item['vala']=$vala;
$item['valb']=$valb;
$head=array($typea.'('.$vala.')',$typeb.'('.$valb.')');
sort($head);
$head=implode('',$head); //funny huh?
if (count(array_unique($same))==1) { if (!isset($crazy[$head])) $crazy[$head]=$item; }
elseif ($item['eq']!=$item['eqs']) { if (!isset($equality[$head])) $equality[$head]=$item; }
elseif (($item['eq']==$item['eqs'])&&($item['eq']=='true')) {
if (!isset($compatible[$head])) $compatible[$head]=$item;
} elseif (($item['lt']==$item['gt'])&&($item['gt']=='true')) {
if (!isset($ltgt[$head])) $ltgt[$head]=$item;
} else { if (!isset($res[$head])) $res[$head]=$item; }
//}
}
}
ksort($crazy);
ksort($res);
ksort($ltgt);
ksort($equality);
ksort($compatible);
$spc=max($vals)+max($types)+2;
print "Very strange: ";
prhead($spc);
foreach ($crazy as $item) prline($item,$spc);
print "\nEqual but not identical: ";
prhead($spc);
foreach ($equality as $item) prline($item,$spc);
print "\nLower and Greater at the same time? ";
prhead($spc);
foreach ($ltgt as $item) prline($item,$spc);
print "\nCompatible (equal and identical): ";
prhead($spc);
foreach ($compatible as $item) prline($item,$spc);
print "\nLower or Greater: ";
prhead($spc);
foreach ($res as $item) prline($item,$spc);
?></pre>
Abusive script
This script was stopped while abusing our resources