Related Links : Search Engine Optimization | | Search Engine Marketing | Online Marketing | Freelance Programmer| SEO Thailand | SEO Expert | SEO services | PHP Programmer Thailand | SEO Tutorial | What is SEO |

  Home Our SEO Services SEO Expert Consultant Php Programmer Scripts| Email : sachin {at} jainsachin {dot} com

PHP | Objects | Manual | Tutorial | Help

SEO Services



Website Programming in PHP / MYSQL



Friends


    Objects

    Objects

    Object Initialization

    To create a new object, use the new statement to instantiate a class:

    <?php
    class foo
    {
        function 
    do_foo()
        {
            echo 
    "Doing foo."
        }
    }

    $bar = new foo;
    $bar->do_foo();
    ?>

    For a full discussion, see the Classes and Objects chapter.

    Converting to object

    If an object is converted to an object, it is not modified. If a value of any other type is converted to an object, a new instance of the stdClass built-in class is created. If the value was NULL, the new instance will be empty. Arrays convert to an object with properties named by keys, and corresponding values. For any other value, a member variable named scalar will contain the value.

    <?php
    $obj 
    = (object) 'ciao';
    echo 
    $obj->scalar;  // outputs 'ciao'
    ?>

    SEO Tutorial / Articles





    Php / Mysql Tutorial



    Articles



      Portfolio


      SEO by Jainsachin