rohidas

Hi I am Rohidas lande.I have teaching in C.D.jain college of commerce Shrirampur .I have Nine year in teaching Experience to teach various programming langauge,script languages,databases like Java,C,C++,php,python,html,css,javascript,mysql,oracle.

Class

             Class


Ø      A class is defined by using the class keyword, followed by the name of the class and a pair of curly braces ({}). all its properties and methods go inside the braces:

      A PHP class is a group of values with a set of operation to manipulate this values.

Ø     PHP classes are almost like functions but with a major different that classes contain both variables and function, in a single format called object or can be said Class is made from a collection of objects

Ø               class is the blueprint of objects.

          Syntax:-

             Class classname

        {

               Variable declaration;

               Properties;

           function method_name()

            {

              body of method;

            }

       function method_name(parameter list)

            {

              body of method;

            }

 

            Example

                 Class student

              {

            public $name;

            function display ($name) 

                   {

                      $this->name=$name;                

        }

               }


                   Rules of Class Declaration

               Ã˜ The class name can be any valid label
               Ã˜ It Can't  be PHP Reserved Word
              Ã˜ A valid class name start with a letter or underscores,followed by any number              of letter, numbers or underscores.
                 You can’t begin the name of method with a double underscore__
            

                                              BACK


Post a Comment

0 Comments