Identifying assignment between the 112-PHP variable to the same object class (ii)

? < PHP
     class MAO {         // definition of feline 
        public  $ Age = 0;         // define a plurality of attributes and initialize 
        public  $ weight = 50 ;
         public  $ Color = 'White' ; 
    } 
    $ MAO1 = new new MAO ();         // instantiate an object 
    $ mao1_a = $ MAO1 ;         // the object identifier assigned to another object 
    // use the variable $ mao1_a access object and modify its properties 
    $ mao1_a -> Age =. 3 ;        
     $ mao1_a -> weight = 1500 ;
     / / use the variable $ mao1 access to the object and its attributes output 
    echo"mao1 at the age of { $ MAO1 ->} Age, body weight { $ MAO1 ->} weight, hair color is { $ MAO1 -> Color}." 
?>

 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/11007420.html