Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $array = array(
- 'My business' => array(
- 'hours' => '9 a.m. to 5 p.m.',
- 'volume' => '100db',
- 'color' => 'black'
- ),
- 'New Business' => array(
- 'hours' => '8 a.m. to 7 p.m.',
- 'volume' => '200db',
- 'color' => 'blue'
- )
- );
- echo json_encode( $array );
- //{"My business":{"hours":"9 a.m. to 5 p.m.","volume":"100db","color":"black"},"New Business":{"hours":"8 a.m. to 7 p.m.","volume":"200db","color":"blue"}}
- $array = json_decode( '{"My business":{"hours":"9 a.m. to 5 p.m.","volume":"100db","color":"black"},"New Business":{"hours":"8 a.m. to 7 p.m.","volume":"200db","color":"blue"}}' );
- print_r( $array );
- Object (
- [My business] => Object
- (
- [hours] => 9 a.m. to 5 p.m.
- [volume] => 100db
- [color] => black
- )
- [New Business] => Object
- (
- [hours] => 8 a.m. to 7 p.m.
- [volume] => 200db
- [color] => blue
- )
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement