Wednesday 16 July 2014

Die() & Exit() Function's in PHP.

The Die() function in php is used for generally printing the message or we can say output.


For Example (i)-


<?php

$conn=mysql_connect("localhost","root","") or die("connection not found");

?>


Example (ii)-

<?php

           $x=5;
           $y=5.2;

if($x==$y)
{
           exit('both are equal');

}

else
{
           exit('both are not equal');
}

?>

The exit( ) function in php is alias of die( ) funciton. It is also used to printing the message.


For Example (i)-


<?php

$conn=mysql_connect("localhost","root","") or die("connection not found");

?>


Example (ii)-


<?php

$x=5;
$y=5.2;

if($x==$y)
{

exit('both are equal');

}

else
{

exit('both are not equal');
}

?>

Full list of Aliases function you will find on following URL:

http://php.net/manual/en/aliases.php


Posted By -Amit Tiwari

Sunday 13 July 2014

What is the difference between PhP4 & PhP5 ?

There are many differences between PHP4 and PHP5-

  1. PHP5 was powered by Zend Engine II,while PHP4 was powered by Zend Engine 1.0
  2. In PHP5 abstract classes are used but not used in PHP4.
  3. In PHP5 interfaces are used but not used in PHP4.
  4. In PHP5 visibility are used but not used in PHP4.
  5. In PHP5 magic methods (such as __call, __get, __set and __toString)are used but not uesd in PHP4.
  6. In PHP5 typehinting are used but not used in PHP4.
  7. In PHP5 incorporates static methods and properties.
  8. In PHP5 cloning are used but not used in PHP4.
  9. In PHP5 construtor are written as __construct keyword but in PHP4 are written as class name.
  10. In PHP5 special function intorduces called __autoload()
  11. In PHP5 there is new error level defined as ‘E_STRICT’
  12. In PHP5 there is new default extensions such as SimpleXML, DOM and XSL, PDO, and Hash.
  13. In PHP5 a new MySQL extension named MySQLi for developers using MySQL 4.1 and later.
  14. In PHP5, SQLite has been bundled with PHP.
Posted by Amit Tiwari