php echo json
<?php
$data = ['name' => 'John', 'age' => 35];
header('Content-type: Application/json');
echo json_encode($data);
php echo json
<?php
$data = ['name' => 'John', 'age' => 35];
header('Content-type: Application/json');
echo json_encode($data);
php json_encode
$person = array(
"name" => "Johny Carson",
"title" => "CTO"
);
$personJSON=json_encode($person);//returns JSON string
json_encode()
json_encode(['name' => 'Jake', 'country' => 'Philippines'])
php array json encode key and value
json_encode($thearray, JSON_FORCE_OBJECT)
php json_encode header detail
$array = array();
$array['Name'] = 'Alex';
$array['Age'] = 37;
$array['Admin'] = TRUE;
$array['Contact'] = array
(
'Site' => "alexwebdevelop.com",
'Phone' => 123456789,
'Address' => NULL
);
$array['Tags'] = array('php', 'web', 'dev');
$json = json_encode($array, JSON_PRETTY_PRINT);
echo '<pre>';
echo $json;
echo '</pre>';
javascript function in php json_encode
$function = "#!!function(){}!!#";
$message = "Hello";
$json = array(
'message' => $message,
'func' => $function
);
$string = json_encode($json);
$string = str_replace('"#!!','',$string);
$string = str_replace('!!#"','',$string);
echo $string;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us