PHP学習ノート十五【対象二向け】

3227 ワード

<?php

  class Cat{

  //public      

   public $name;

   public $age;

  }

  //  

  $cat1=new Cat;

  $cat1->name="  ";

  //            $   ->   

  echo $cat1->name;

  echo "<br/>";

  class Person

  {

     public $name;

     public $age;

  }

  

  $a=new Person();

  $a->name="  ";

  $a->age=20;

  //

  $b=$a;

  echo $a->name."<br/>";

  echo $b->name."<br/>";

  

  echo "<br/>";

  $p1=new Person();

  $p1->name="  ";

  $p1->age=7;

  function test1($p)

  {

     $p->name="  ";

  }

  echo $p1->name; //

?>