note 40285 deleted from function.explode by nlopess
| From: | nlopess@php.net | Date: | Fri, 27 Feb 2004 13:23:13 +0000 |
| Subject: | note 40285 deleted from function.explode by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65882@lists.php.net to get a copy of this message | ||
Note Submitter: nihaopaul[more@spam]hotmail.com
----
question:
as in the example:
<?php
// Example 1
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
?>
this doesn't work if you have more spaces in the string...
i.e
<?php
exec('df -h | grep usr', $diskspace);
$tiral_diskspace = $diskspace[0];
echo $tiral_diskspace."<br>";
$disk_space = explode(" ", $tiral_diskspace);
echo $disk_space[12]; //was going to us this for a fix to get the variable i wanted but then thought
twice
?>
output would be something like:
/dev/ad0s2f 1044394 602704 358140 63% /usr
what would i use then to filter out doubles spaces?
Paul