1phpCopy<?php
2 $array = ["Lili", "Rose", "Jasmine", "Daisy"];
3 $JsonObject = json_encode($array);
4 echo "The array is converted to the Json string.";
5 echo "\n";
6 echo"The Json string is $JsonObject";
7?>
8
1phpCopy<?php
2 $array = ["Lili", "Rose", "Jasmine", "Daisy"];
3 $JsonObject = serialize($array);
4 echo "The array is converted to the Json string.";
5 echo "\n";
6 echo"The Json string is $JsonObject";
7?>
8
1phpCopy<?php
2$arr = array("This","is", "an", "array");
3$string = implode(" ",$arr);
4echo "The array is converted to the string.";
5echo "\n";
6echo "The string is '$string'";
7?>
8