blob: 35c85759a7513fc1c24e69e8a79cf2a1d0a43009 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
<?php
require('../w/class/art2.php');
$art = new Art2(['id' => 'rr']);
$art->reset();
$art->hydrate((['description' => 'fdsfs', 'secure' => 0]));
var_dump($art);
$artencoded = json_encode($art);
var_dump($artencoded);
class Person
{
public $id;
public $name;
public $table = ['coucou', 'lol', 'chouette'];
public $date;
public function __construct(array $data)
{
$this->id = $data['id'];
$this->name = $data['name'];
$this->date = new DateTimeImmutable();
}
}
$person = new Person(array('id' => 1, 'name' => 'Amir'));
$jsonperson = json_encode($person);
var_dump($jsonperson);
var_dump(json_decode($jsonperson));
?>
|