Re: [PHP] How to use a variable variable with an array

2011-12-13 Thread Laruence
On Wed, Dec 14, 2011 at 9:27 AM, Nils Leideck wrote: > Hi Al, > > many thanks for your feedback. Unfortunately I don’t know the deepness of the > array so I can’t use the nested foreach() idea :-( Let me try to simplify my > question (which also helps myself to clarify my process ;-) > > I have

[PHP] How to use a variable variable with an array

2011-12-13 Thread Nils Leideck
Hi Al, many thanks for your feedback. Unfortunately I don’t know the deepness of the array so I can’t use the nested foreach() idea :-( Let me try to simplify my question (which also helps myself to clarify my process ;-) I have a variable where the value is a string that is exactly the path to

[PHP] Re: How to use a variable variable in an array walk?

2011-12-13 Thread Al
On 12/13/2011 5:43 PM, Nils Leideck wrote: Anyone?:-( is my description too unclear? On 11.12.2011, at 11:25, Nils Leideck wrote: this is my first post to the PHP general list. I have an issue with a variable variable (http://php.net/manual/en/language.variables.variable.php) My use c

[PHP] Re: How to use a variable variable in an array walk?

2011-12-13 Thread Nils Leideck
Anyone?:-( is my description too unclear? On 11.12.2011, at 11:25, Nils Leideck wrote: > this is my first post to the PHP general list. > I have an issue with a variable variable > (http://php.net/manual/en/language.variables.variable.php) > > My use case: > > I have an array called $myAr

Re: [PHP] Question about socket_select

2011-12-13 Thread Matijn Woudt
On Wed, Dec 14, 2011 at 12:11 AM, Mihai Anghel wrote: > Hello, > > It appears to me that something is strange with the socket_select function. > From what I understand the value of the fourth parameter, tv_sec, > should block the execution of the script for that number of seconds. > I tried this c

[PHP] Question about socket_select

2011-12-13 Thread Mihai Anghel
Hello, It appears to me that something is strange with the socket_select function. >From what I understand the value of the fourth parameter, tv_sec, should block the execution of the script for that number of seconds. I tried this code : http://www.php.net/) To unsubscribe, visit: http://www.php.

Re: [PHP] Unique items in an array

2011-12-13 Thread Lester Caine
Marc Guay wrote: If the contact_id is the primary key, you could also use that as array index, which would automatically filter duplicates. Thanks for this, it's so obvious I didn't see it. I was adding items to the array with $array[] = $contact when I could have just as easily used $array[$c

Re: [PHP] Unique items in an array

2011-12-13 Thread Marc Guay
> If the contact_id is the primary key, you could also use that as array > index, which would automatically filter duplicates. Thanks for this, it's so obvious I didn't see it. I was adding items to the array with $array[] = $contact when I could have just as easily used $array[$contact['id']] =

Re: [PHP] Unique items in an array

2011-12-13 Thread Matijn Woudt
On Tue, Dec 13, 2011 at 10:15 PM, Marc Guay wrote: > Hi folks, > > Let's say that I have the following array: > >  [0]=> >  array(35) { >    ["contact_id"]=> >    string(3) "356" >    ["contact_first_name"]=> >    string(4) "Marc" >  } >  [1]=> >  array(35) { >    ["contact_id"]=> >    string(3) "

Re: [PHP] Unique items in an array

2011-12-13 Thread Ashley Sheridan
On Tue, 2011-12-13 at 16:15 -0500, Marc Guay wrote: > Hi folks, > > Let's say that I have the following array: > > [0]=> > array(35) { > ["contact_id"]=> > string(3) "356" > ["contact_first_name"]=> > string(4) "Marc" > } > [1]=> > array(35) { > ["contact_id"]=> >

[PHP] Re: Unique items in an array

2011-12-13 Thread Marc Guay
Holy mother of multidimentionality there are a ton of suggested solutions to this scenerio on the array_unique manual page.. http://php.net/manual/en/function.array-unique.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Unique items in an array

2011-12-13 Thread Marc Guay
Hi folks, Let's say that I have the following array: [0]=> array(35) { ["contact_id"]=> string(3) "356" ["contact_first_name"]=> string(4) "Marc" } [1]=> array(35) { ["contact_id"]=> string(3) "247" ["contact_first_name"]=> string(4) "Marc" } [2]=> a

Re: [PHP] Split

2011-12-13 Thread Dajka Tamás
Hi, First, read the help of 'preg_replace' at php.net. Second: try this: preg_split('/\//',$sPath,$iMax) Third: use explode: explode('/',) Cheers, Tamas 2011.12.13. dátummal, 21:33 időpontban Jack írta: > OK so I have seen enough errors about split, so I decided to update my co

Re: [PHP] Split

2011-12-13 Thread Daniel Brown
On Tue, Dec 13, 2011 at 15:33, Jack wrote: > OK so I have seen enough errors about split, so I decided to update my code: > >  return split("/", $sPath, $iMax); > > > > I tried: > > return preg_split("/", $sPath, $iMax); > > return preg_split("/", $sPath, $iMax, PREG_SPLIT_DELIM_CAPTURE); > > > >

[PHP] Split

2011-12-13 Thread Jack
OK so I have seen enough errors about split, so I decided to update my code: return split("/", $sPath, $iMax); I tried: return preg_split("/", $sPath, $iMax); return preg_split("/", $sPath, $iMax, PREG_SPLIT_DELIM_CAPTURE); and a few other combinations, in the end always with errors. n