The explode() function allows you to turn a String into an Array based on a separator you define.
explode()
- https://www.php.net/manual/en/function.explode.php
- https://www.w3schools.com/php/func_string_explode.asp
explode.php
<?php
$string = "This is a string, that I will EXPLODE, in this project. Play around with it. See how seperators work.";
$stringArray = explode(".",$string);
echo $string;
echo "<br><br>";
var_dump($stringArray);
echo "<br><br>";
foreach($stringArray as $word) {
echo $word."<br>";
}
?>
Be the first to comment