Richard Lynch wrote:
On Tue, April 19, 2005 7:03 am, Jochem Maas said:
The 'other' guy mentioned that while() is faster than foreach,
is this true?
Don't know ; Don't care.
You should never loop through so many things in PHP that it matters in the
first place :-)
I read a few days ago somewhere
Sorry jocham, for you getting this twice.
I'd assume foreach is recommended because it lends to more readable
code. More readable code, is generally considered better code.
Personally I'd disagree and use while( list() = each() ), because it
doesn't create a copy of the array in memory,
explode by ,
$output1 = explode(,,$string);
use a loop and explode array $output1 by :
Hope this helps.
Saswat
On 4/18/05, Sebastian [EMAIL PROTECTED] wrote:
$string = '4:gaming,5:hardware,3:software,8:security';
what is the best way to explode then loop this string after its taken
Richard Lynch wrote:
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';
$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':', $idcat);
echo \$id = $idbr /\n;
echo \$cat = $catbr /\n;
}
The
On Tuesday 19 April 2005 17:03, Jochem Maas wrote:
Richard Lynch wrote:
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';
$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':',
Petar Nedyalkov wrote:
On Tuesday 19 April 2005 17:03, Jochem Maas wrote:
Richard Lynch wrote:
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';
$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
list($id, $cat) =
On Tue, April 19, 2005 7:03 am, Jochem Maas said:
The 'other' guy mentioned that while() is faster than foreach,
is this true?
Don't know ; Don't care.
You should never loop through so many things in PHP that it matters in the
first place :-)
I read a few days ago somewhere on php.net that
$string = '4:gaming,5:hardware,3:software,8:security';
what is the best way to explode then loop this string after its taken apart.
output should be something like:
$id = 4
$cat = gaming
etc..
im just looking for the best/fastest way to do this. the string can grow to
200 or so bytes, maybe
On Monday 18 April 2005 14:34, Sebastian wrote:
$string = '4:gaming,5:hardware,3:software,8:security';
what is the best way to explode then loop this string after its taken
apart.
output should be something like:
$id = 4
$cat = gaming
etc..
im just looking for the best/fastest way to
On Mon, April 18, 2005 4:34 am, Sebastian said:
$string = '4:gaming,5:hardware,3:software,8:security';
$idcats = explode(',', $string);
while (list(, $idcat) = each($idcats)){
list($id, $cat) = explode(':', $idcat);
echo \$id = $idbr /\n;
echo \$cat = $catbr /\n;
}
what is the best way
Any ideas how to do this,
I have a string
734088+3+734132+9+734138+80+781007+1+
I need to place the string into a multi-array like so
array[0][0] = 734088
array[0][1] = 3
array[1][0] = 734132
array[1][1] = 9
array[2][0] = 734138
array[2][1] = 80
etc...
Now ive tried everything i know any
[snip]
Any ideas how to do this,
I have a string
734088+3+734132+9+734138+80+781007+1+
I need to place the string into a multi-array like so
array[0][0] = 734088
array[0][1] = 3
etc...
Now ive tried everything i know any ideas?
[/snip]
start with explode
$arrString = explode(+,
Erin mailto:[EMAIL PROTECTED]
on Wednesday, November 12, 2003 9:13 AM said:
734088+3+734132+9+734138+80+781007+1+
I need to place the string into a multi-array like so
array[0][0] = 734088
array[0][1] = 3
[snip]
Now ive tried everything i know any ideas?
Yes. You need to somehow
Chris W. Parker
on Wednesday, November 12, 2003 9:19 AM said:
Without knowing any other way to do this I would use a regex to skip
the first + and change second one, repeating this until the end of the
string.
Considering Jay's answer for this question, do I always do things the
hard way
[snip]
Considering Jay's answer for this question, do I always do things the
hard way or what??
[/snip]
Young Grasshopper...there is more than one way to do things, a lot of
them are rightsome are just harder than others.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe,
Jay Blanchard wrote:
[snip]
Considering Jay's answer for this question, do I always do things the
hard way or what?? [/snip]
Young Grasshopper...there is more than one way to do things,
a lot of them are rightsome are just harder than others.
Isn't that the diplomatic equivalent of
16 matches
Mail list logo