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
|
||||
class Person {
|
||||
public $name;
|
||||
public $age;
|
||||
}
|
||||
include 'data/people.php';
|
||||
|
||||
$me = new Person();
|
||||
$me->name = 'Matt';
|
||||
$me->age = 37;
|
||||
|
||||
echo json_encode($me);
|
||||
echo json_encode($people);
|
||||
?>
|
||||
|
||||
@ -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