Re: PHP Brainteasers 2011

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 20, 2011 at 12:55, Marc Guay <marc@xxxxxxxxxxxxxxxxxxxx> wrote:
> I imagine this one's been done before, but maybe not in the same way....

    I believe it was, but not quite the same, you're right.

        "If at first you don't succeed, try, try again."

    Nice one, Marc.



> <?php
>
>        $result = succeed();
>
>        while (!$result){
>                try{
>                        $result = succeed();
>
>                }
>                catch (Exception $e){
>                        echo $e;
>                }
>        }
>        echo "hell yeah";
>
>        function succeed(){
>                $a = rand(1,2);
>
>                switch($a){
>                        case 1:
>                                trigger_error('fml');
>                                break;
>                        case 2:
>                                return TRUE;
>                                break;
>                }
>        }
> ?>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux