- BASICS
- Quotes
- Constants
- Control Structures
- Reference
- Number Systems
- VARIABLES
- Definition
- Variable Variable
- Exists
- Type Casting
- OPERATORS
- Aritmetic
- Bitwise
- String
- Comparison
- Logical
- FUNCTION
- Definition
- Anonymous
- Reference
- Variable Arguments
- ARRAY
- Basics
- Operations
- Create
- Search
- Modify
- Sort
- Storage
- STRING
- String Basics
- String Compare
- String Search
- String Replace
- String Format
- String Regexp
- String Parse
- Formating
-
Json
- STREAMS
- File Open
- Read File
- Read Csv
- File Contents
- Context
- Ob_start
- OOP
- Object Instantiation
- Class Constructor
- Interfaces, Abstract
- Resource Visibility
- Class Constants
- Namespaces
- HTTP
- Headers
- File Uploads
- Cookies
- Sessions
Json
JSON (JavaScript Object Notation). It is the actual form that a JavaScript engine will map the object to in memory. PHP have native support for JSON.Decode
Return the json representation of a value
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
var_dump(json_decode($json)); // returns object
// { "a"=> 1, "b"=>2, ... }
var_dump(json_decode($json, true)); // returns array
// [ "a"=> 1, "b"=>2, ... ]
$json = '';
var_dump(json_decode($json));// NULL
Encode
Returns a JSON encoded string on success or FALSE on failure
code
$arr = array('a' => 1, 'b' => 2, 'c' => 3);
echo json_encode($arr); // {"a":1,"b":2,"c":3}
Last update: 523 days ago