Archive for the ‘PHP’ Category
floor() in Php
Wednesday, November 5, 2008 23:27 2 Commentsfloor() is the opposite of Ceil(). It rounds down a floating-point number to the next-lowest integer, no matter what the value of the floating-point number is. Integer on success; FALSE on error Example #1 floor() example < ?php echo floor(4.3); // 4 echo floor(9.999); // 9 echo floor(-3.14); // -4 ?>
ceil() in php
Wednesday, November 5, 2008 23:16 No CommentsThe ceil() function Returns an integer that is the next larger than the float used as the argument. In essence, it rounds up a floating-point number to an integer, no matter what the value of the floating-point integer is. It doesn’t round down. Example#1 ceil() example < ?php echo ceil(4.3); // 5 echo ceil(9.999); // [...]
multiple catch block in php
Saturday, November 1, 2008 9:56 No CommentsSome time there is a need to catch more than one exception..In such a situation, we can associate more than one catch statement with a try, When an exception is thrown, the exception handlers are searched in order for an appropriate match. The first handler that yields a match is executed. After executing the handler, [...]
throw Exception in php
Friday, October 31, 2008 9:52 No Commentstry { doExchange(); throw new Exception(“D’oh!”); echo “hai”; } catch (Exception $except) { logger.error(“doExchange failed”, e); } In that example, PHP enters the “try” block and starts executing code. When it hits the line “throw new Exception”, it will stop executing the “try” block, and jump to the “catch” block. Here it checks each exception [...]
try and catch block in php
Thursday, October 30, 2008 8:47 1 CommentException handling is used to change the normal flow of the code execution if a specified error (exceptional) condition occurs. This condition is called an exception. Try block is used to try for the code to execute if any error like file unable to open etc.. It will stop the execution and it will throw [...]
