class Fruit { public $count = 3; public $type; }
$apple = new Fruit();
$apple->type = "apple";
print $apple->count; // 3 print
$apple->type; // apple
Asked
Active
Viewed 12 times
0
Qirel
- 23,315
- 7
- 41
- 57
Yuya Kawahara
- 97
- 1
- 1
- 4
-
You're looking at object oriented programming. – Qirel Mar 25 '17 at 16:17
-
ever heard of `$this` ? http://php.net/manual/en/language.oop5.php – Funk Forty Niner Mar 25 '17 at 16:20