Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created March 6, 2015 17:27
Show Gist options
  • Save jordanorelli/3645189afab2431b61e5 to your computer and use it in GitHub Desktop.
Save jordanorelli/3645189afab2431b61e5 to your computer and use it in GitHub Desktop.
<?php
$thing = [
"x" => 1,
"y" => 2
];
var_dump($thing);
$json = json_encode($thing);
echo $json . "\n";
$thing2 = json_decode($json);
var_dump($thing2);
echo $thing == $thing2 ? "yes" : "no" . "\n";
```
# output from running the above code:
array(2) {
["x"]=>
int(1)
["y"]=>
int(2)
}
{"x":1,"y":2}
object(stdClass)#1 (2) {
["x"]=>
int(1)
["y"]=>
int(2)
}
no
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment