Want to learn php5 to see _php tutorial

Source: Internet
Author: User
PHP Code:--------------------------------------------------------------------------------function FactoryMethod ($ Class_type) {switch ($class _type) {case ' foo ': $obj = new Myfoo (); break, case ' bar ': $obj = new Mybar (); break;} retur n $obj; } $object = FactoryMethod ("foo"); $object->method ()->method () $copy _of_object = $object->__clone (); Class MyClass {function __destruct () {...//Run destructor code}} delete $object; Class Shape {function __construct () {//Shape initialization code ...}; Class Square extends Shape {function __construct () {parent::__construct ();//Square-specific initialization code ...} ... }; class Foo {private $priv _var; function Some_method (...) {$this->priv_var = ...;//Zend: $priv _var = ...; I haven't tried. } }; Class Logger {static $m _instance = null, function Instance () {if (Logger:: $m _instance = null) {Logger:: $m _instance = NE W Logger (); } return Logger:: $m _instance; } function Log () {...}}; $Logger = Logger::instance (); $Logger->log (...); Try {... code if (failure) {throw new MyException ("Failure"),} ... code} catch ($exception) {... handle exception throw $EXCEP tion; Re-throw exception. }

http://www.bkjia.com/PHPjc/532143.html www.bkjia.com true http://www.bkjia.com/PHPjc/532143.html techarticle PHP Code:--------------------------------------------------------------------------------function FactoryMethod ($class _type) {switch ($class _type) {case "foo": $obj = new M ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.