<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="../styles.css">
<title>PHP: Implode</title>
</head>
<body>
<h1 class="lesson-h1">Implode() | Turns Array Into String</h1>
<?php
$images = [
'https://www.christow.blog/wp-content/uploads/2020/12/post.jpg',
'https://www.christow.blog/wp-content/uploads/2020/12/get.jpg',
'https://www.christow.blog/wp-content/uploads/2020/12/pexels-photo-4197438.jpeg',
'https://www.christow.blog/wp-content/uploads/2020/12/blogPhotos-01.jpg'
];
$imploded_images = implode(',', $images);
echo "<h4>Before Implode() This is an Array</h4>";
echo var_dump($images);
echo "<h4>After Implode() This is a String</h4>";
echo var_dump($imploded_images);
$names = ['Chris Tow', 'Reow Reow', 'Inga Smith'];
$imploded_names = implode(',', $names);
echo "<hr><h4>Second Implode Example</h4>";
print_r($names);
echo "<br><br>";
//Now the Array has been turned into one string
echo var_dump($imploded_names);
echo "<br><hr>";
include('../show_code.php');
show_code('index.php');
?>
</body>
</html>