parsing words

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have an array and I want to fetch it and get each values that starts
with "col" in the array and do something with them, how can I do that?

Re: parsing words wrote in message
Quoted text here. Click to load it

let $array be your array

foreach ($array as $i => $value) {
   $line = $array[$i];
   $tok = strtok($string," \n\t");
   if($tok == "col")
     do something

Re: parsing words

I noticed that Message-ID: contained the following:

Quoted text here. Click to load it

For each value in the array use substr() to see if the first three
letters =="col"   

Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs /

Re: parsing words wrote:
Quoted text here. Click to load it
array_filter() or even better, array_keys() with optional value.

"La demande mondiale d’ordinateurs n’excédera pas cinq machines."
(Thomas Watson, Fondateur d'IBM, 1945)

Site Timeline