Example 1: php Array to string conversion
Using implode() function in Php
-----------------------
Syntax
implode(separator,array);
Example
<?php
$dummyArr = array("Hello","Greppers,","Ankur","here !");
echo implode(" ",$dummyArr);
?>
Output:
Hello Greppers, Ankur here !
Example 2: array to string conversion in php
$person = [
'name' => 'Jon',
'age' => 26,
'status' => null,
'friends' => ['Matt', 'Kaci', 'Jess']
];
echo json_encode($person);
Example 3: php array to string
$str = implode('|', $arr);
$str = json_encode($arr);
$str = var_export($arr);
Example 4: arry to string php
implode("|",$type);
Comments
Post a Comment