You need to break a string into pieces.
Use explode() if what separates the pieces is a constant string.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN">
<head>
<title>PHP</title>
<meta Name="Author" Content="Hann So">
</head>
<body>
<p>
<?php
$string = "This weekend, I'm going shopping for a new clothe.";
echo $string, "<br />";
$string = explode(' ', $string);
print_r($string);
?>
</p>
</body>
</html>
|