oops in php

Class best practices

  1. Capitalize and camelcase class names
  2. Make nouns singular
  3. Define each class in a seprate file
  4. group class files in a directory

Functions for Classes:

  1. get_declared_classes():-Returns an array with the name of the defined classes
  2. class_exists($string):-Checks if the class has been defined


class Student{

echo "classes:".implode(',',$classes).'<br>';


foreach($class_names as $class_name){

   echo "{$class_name} is declared class.<br>";
    echo "{$class_name} is not declared class.<br>";



Teacher is not a declared class
Student is a declared class
student is a declared class