Ping (zestyping) wrote,

Why PHP should never be taught, Part II.

This is a follow-up to Why PHP should never be taught.

% cat comparison.php
<?php

$a = -1;
$b = 0;
$c = 1;
$d = True;

print "d > $a: "; print ($d > $a) ? "yes\n" : "no\n";
print "d > $b: "; print ($d > $b) ? "yes\n" : "no\n";
print "d > $c: "; print ($d > $c) ? "yes\n" : "no\n";
print "\n";
print "d < $a: "; print ($d < $a) ? "yes\n" : "no\n";
print "d < $b: "; print ($d < $b) ? "yes\n" : "no\n";
print "d < $c: "; print ($d < $c) ? "yes\n" : "no\n";
print "\n";
print "e > $a: "; print ($e > $a) ? "yes\n" : "no\n";
print "e > $b: "; print ($e > $b) ? "yes\n" : "no\n";
print "e > $c: "; print ($e > $c) ? "yes\n" : "no\n";
print "\n";
print "e < $a: "; print ($e < $a) ? "yes\n" : "no\n";
print "e < $b: "; print ($e < $b) ? "yes\n" : "no\n";
print "e < $c: "; print ($e < $c) ? "yes\n" : "no\n";
?>

% php comparison.php 
d > -1: no
d > 0: yes
d > 1: no

d < -1: no
d < 0: no
d < 1: no

e > -1: no
e > 0: no
e > 1: no

e < -1: yes
e < 0: no
e < 1: yes
%
Aaaarghhh!!! It's so arbitrary.
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 110 comments
Previous
← Ctrl← Alt
Next
Ctrl →Alt →
Previous
← Ctrl← Alt
Next
Ctrl →Alt →