Friday, November 25, 2016

How To Use Explode In Php

              We use explode function to split a string into an array of strings by using string delimiter.
String delimiter is the string that use for separate a string  into sub-string at any string in source string that equal to delimiter.
for example

<html>
<head>
<title>My php</title>
</head>
<body>
<?php
$str="Mr ISteav How We ARe";
$str1=explode("H",$str);
foreach ($str1 as $value){
echo '<p>'.$value.'</p>';
}

?>
</body>
</html>


example above function explode will spilt $str into two string at "H" in $str



No comments:

Post a Comment