Re: Jump to a point
| From: | heilo | Date: | Sat, 19 Apr 2003 19:27:12 +0000 |
| Subject: | Re: Jump to a point | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27185@lists.php.net to get a copy of this message | ||
Hi!
Apparot from the deed, that this doesn't really belong to the db-list and if
i understood you right, try this:
$search = 'three'
$str = 'one:two:three:four:five:six:seven:eight';
$arr = explode(':', $str);
$c = 0;
foreach($arr as $elm)
{
if(strtolower($elm) == strtolower($search))
break;
$c++;
}
$firstData = $arr[$c+3]; // Will be 'six'
$secondData = $arr[$c+5]; // Will be 'eight'
I hope this helps?
.ma
Miguel Brás <molino26@netcabo.pt> wrote@19.04.2003 20:58 Uhr:
> Hi,
>
> I have made a script that reads a file on a remote host, it copy his content
> to my host and makes a search for a given string
>
> the data is separated by : and each field is one thing. Whatt i wanna do is
> if I find the given string on the test, the script will jump 3 : to read the
> next data, and then jump 2 : to read the other dataa.
>
> Any way for that?
>
> Miguel
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>