Given a PHP value, which sample shows how to convert the value to JSON?

Given a PHP value, which sample shows how to convert the value to JSON?
A . $string= json_encode($value);
B . $string= Json::encode($value);
C . $json = new Json($value); $string= $json-> toString();
D . $value= (object) $value; $string= $value-> toJson();

Answer: A

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments