Returns the JSON representation of a value.
Syntax
json_encode(mixed $value, int $flags = 0): string|falseExample
Enter values below to update the example in real time.
data→json_encode→JSON_UNESCAPED_UNICODE→back→json_decode→echo→Alice→$data = ["name" => "Alice", "age" => 30];
$json = json_encode($data, JSON_UNESCAPED_UNICODE);
$back = json_decode($json, true);
echo $back["name"]; // Alice