parent
a8d33efb56
commit
331f0b7507
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
include 'models/person.php';
|
||||||
|
$people = array();
|
||||||
|
|
||||||
|
$people[] = new Person('joni', 52);
|
||||||
|
$people[] = new Person('bob', 34);
|
||||||
|
$people[] = new Person('sally', 21);
|
||||||
|
$people[] = new Person('matt', 37);
|
||||||
|
?>
|
||||||
@ -1,12 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
class Person {
|
include 'data/people.php';
|
||||||
public $name;
|
|
||||||
public $age;
|
|
||||||
}
|
|
||||||
|
|
||||||
$me = new Person();
|
echo json_encode($people);
|
||||||
$me->name = 'Matt';
|
|
||||||
$me->age = 37;
|
|
||||||
|
|
||||||
echo json_encode($me);
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -0,0 +1,10 @@
|
|||||||
|
<?
|
||||||
|
class Person {
|
||||||
|
public $name;
|
||||||
|
public $age;
|
||||||
|
public function __construct($name, $age) {
|
||||||
|
$this->name = $name;
|
||||||
|
$this->age = $age;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
Loading…
Reference in new issue