[man]explode/man can do this also. So I'll give you both, in one script....
<?php
echo '<h3>explode() method</h3>';
$string = 'this * is * a * book';
$parts = explode('*', $string);
$string1 = $string2 = '';
for($i=0; $i<count($parts)-1; $i++)
{
if($i<count($parts)-2)
{
$string1 .= $parts[$i].' * ';
}
if($i<count($parts)-1)
{
$string2 .= $parts[$i].' * ';
}
}
echo $string1.'<br>'.$string2;
echo '<hr><h3>substr() method</h3>';
$string = 'this * is * a * book ';
$part1 = substr($string, 0, strpos($string, '*', strpos($string, '*')+1));
$part2 = substr($string, 0, strrpos($string, '*', strrpos($string, '*')-1));
echo $part1.'<br>'.$part2;
?>
Gives this output:
explode() method
this * is *
this * is * a *
substr() method
this * is
this * is * a