PHP Brainteasers 2011

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

 



I imagine this one's been done before, but maybe not in the same way....


<?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



[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