3 thoughts on “Second PHP Challenge”

  1. andreea.paraschiv

    Well done, guys!

    Our solutions were:
    1.
    $a = $a + $b
    $b = $a – $b
    $a = $a – $b

    2.
    $a = $a * $b;
    $b = $a / $b;
    $a = $a / $b;

    3.
    $a = $a ^ $b;
    $b = $a ^ $b;
    $a = $a ^ $b;

    4.
    list($a, $b) = array($b, $a);
    OR
    list($a,$b) = array_reverse(array($a,$b));

    5.
    extract(array(‘a’=>$b, ‘b’=>$a));

    6.
    file_put_contents(‘a.txt’,$a);
    file_put_contents(‘b.txt’,$b);

    $a = file_get_contents(‘b.txt’);
    $b = file_get_contents(‘a.txt’);

    7.
    $a = $a <> strlen(decbin($b));
    $a = $b << (strlen(decbin($a)) – strlen(decbin($b))) ^ $a;

    So.. when it comes to web development, we do get creative!

Leave a Comment

Your email address will not be published.

Scroll to Top