<?php
$str = "Hello world. It's a beautiful day.";
$split = explode(" ",$str);
$hello = $split[0];
$world = $split[1];
?>
<html>
<body bgcolor="pink">
<h3>Implode Function</h3>
<?php
$arr=array ('I','am','simple','boy!');
echo implode(" ",$arr);
$str="I am simple boy!";
print_r(explode(" ",$str));
?>
</body>
</html>
$str = "Hello, kinjal, how, are, you";
// it will convert string to array
$s1 = explode(",", $str);
echo "<pre>";
print_r($s1);
$stringArray = ['Name=xyz','Email=xyz43@gmail.com','Password=xyz@123','Address=xyz University Lucknow'];
$loginCredentials = [];
foreach($stringArray as $item){
$data = explode('=', $item);
if(in_array('Email',$data) || in_array('Password',$data)){
$loginCredentials[$data[0]] = $data[1];
}
}
//Output desired array
print_r($loginCredentials);