Monday, April 24, 2017

Class exists

<?php
if (! class_exists('Article', false)):
echo "Class Article doesn't exists, load class<br/>";
class Article { 
}
else:
echo "Class Article exists!<br/>";
endif;

if (class_exists('Article', false)):
echo "Class Article exists!";
endif;
?>
Output:
Class Article doesn't exists, load class
Class Article exists!

No comments:

Post a Comment

here docs

$x = <<<THE_END PHP stands for "PHP: Hypertext Preprocessor". The acronym "PHP" is therefore, usually referre...