Archive for the ‘PHP’ Category:
PHP ociparse Error Handling
ociparse
(PHP 4, PHP 5, PECL oci8:1.0-1.2.4)
ociparse — Alias of oci_parse()
Description
This function is an alias of: oci_parse().
$stmt = OCIParse($conn, $query);
if (!$stmt) {
$err = OCIError($conn);
echo “Error:”.$err[”message”];
}
PHP MySQL Connect
MySQL Connect
<?php
$connection=mysql_connect(”localhost”, “username”, “password”) or die(mysql_error());
echo “Connected to MySQL<br />”;
?>
Simple PHP Exception Handling explanation
What is an Exception
Finaly, with php5 came a new object oriented way for dealing errors,
if a specified error (exceptional) condition occurs exception handling is used to change the
flow of the code execution .
Exceptions are a great tool and should only be used with error conditions,
dont ever use them to jump to another place in the code at a specified
point - you cant know what will happend.
Basic Use of php5 Exceptions
When an exception is thrown, PHP will try to find the matching “catch” block.
The bad way:
<?php
function checksum($number1=NULL,$number2=NULL)
{
if($number1===NULL OR $number2===NULL)
{
throw new Exception("Value must not be NULL");
}
return true;
}
checksum(7,NULL);
?>
The good way:
Good Luck! use this php5 tool smartly.
Migration to PHP5
1) Improve performance
2) Fully Web2 Integration
3) PHP4 Is 8 years old! Old! Old!
4)Proven in business critical deployment
5) Php5 Is Designed for Modern Web Applications (Json,Web Services ech)
6)New Zend Engine (Version 2) - Up to 4X Faster
7) New object Model (Design Pattern, Cloning ech)
better Memory management
9) Great XML Support (Simple XML,DOM ech)
10)Very Easy Soap!
More Information available at:
http://www.zend.com/webinar/PHP/webinar-php4-php5-migration-20080326.flv
Some PHP 4 Facts!
1) Php4 was born in 2000
2) PHP4 Security fix will be available until 8 August 2008
3) PHP4 Support ended in 1.1.2008
4) PHP4 will always be available for download
5) PHP5 Is already 3 years old!
So, Why are you still using PHP4, migrate to 5 ASAP

