note 65176 deleted from language.oop5 by nlopess
| From: | nlopess@php.net | Date: | Sun, 11 Mar 2007 12:46:59 +0000 |
| Subject: | note 65176 deleted from language.oop5 by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124327@lists.php.net to get a copy of this message | ||
Note Submitter:
----
<?php
if (class_exists("cl_test")) return;
echo "ppppp";
class cl_test{
function cl_test(){
echo "quirky...";
}
} // class definition ends
?>
although the logic is clear php treats the above code differently. PHP translates it to:
class cl_test{
function cl_test(){
echo "quirky...";
}
} // class definition ends
if (class_exists("cl_test")) return;
echo "ppppp";
If you must have the previous logic to work you are forced to have the following code:
if (!class_exists("cl_test")) {
echo "ppppp";
class cl_test{
function cl_test(){
echo "quirky...";
}
} // class definition ends
}