Re: [PHP] array_push

2012-09-02 Thread John Taylor-Johnston
Frank Arensmeier wrote: 2 sep 2012 kl. 19.48 skrev John Taylor-Johnston: Why not add two lines of code within the first loop? $chunks = explode("-30-", $mystring); foreach($chunks as $chunk) { preg_match_all("/News Releases\n(.+)/s", $chunk, $matches); foreach($matches[1] as $matched

Re: [PHP] array_push

2012-09-02 Thread Frank Arensmeier
2 sep 2012 kl. 19.48 skrev John Taylor-Johnston: > How can I clean this up? >>> My approach would be to split the hole text into smaller chunks (with e.g. >>> explode()) and extract the interesting parts with a regular expression. >>> Maybe this will give you some ideas: $chunks = explode("

[PHP] array_push

2012-09-02 Thread John Taylor-Johnston
How can I clean this up? My approach would be to split the hole text into smaller chunks (with e.g. explode()) and extract the interesting parts with a regular expression. Maybe this will give you some ideas: $chunks = explode("-30-", $mystring); foreach($chunks as $chunk) { preg_match

Re: [PHP] array_push in array maps

2006-05-03 Thread John Wells
On 5/3/06, Jochem Maas <[EMAIL PROTECTED]> wrote: Jonas Said: >> But when I want to have a value from a special column i a row the >> followint >> doesn't work: >> >>$test[$row[2]] = $row[5]; >> >> Or: >> >>$test[$row(2)] = $row[5]; >> >> Do I need to do some kind of concatenating? >> A

Re: [PHP] array_push in array maps

2006-05-03 Thread Jochem Maas
Jonas - what do you mean 'it doesn't work' (it's like me saying 'the ATM doesn't work and forgetting to mention I'm trying to withdraw 10,000,000 disney dollars - when I mention that fact the reason is probably obvious to you why it doesn't work) Brad Bonkoski wrote: What kind of values are sto

Re: [PHP] array_push in array maps

2006-05-03 Thread Brad Bonkoski
What kind of values are stored in $row[2] and $row[5]? You might need to keep the single quotes $test['$row[2]'] = $row[5]; -Brad Jonas Rosling wrote: There's allways mutch to learn. :-) I'm very happy for all help I can get. I ran into another problem when trying to insert a value. I had

Re: [PHP] array_push in array maps

2006-05-03 Thread Jonas Rosling
There's allways mutch to learn. :-) I'm very happy for all help I can get. I ran into another problem when trying to insert a value. I had no problem with: $test['something'] = '2500'; But when I want to have a value from a special column i a row the followint doesn't work: $test[$row[2]

Re: [PHP] array_push in array maps

2006-05-03 Thread Jochem Maas
Jonas Rosling wrote: Need solve another case regarding array maps. Is it possible to insert more Jonas - in php we just call these things arrays (no 'map') - the array datatype in php is a mash up (and we love it :-) of the 'oldschool' numerically indexed array and what is commonly known as a h

Re: [PHP] array_push in array maps

2006-05-03 Thread Jochem Maas
Stut wrote: Brad Bonkoski wrote: $colors['black'] = '#ff'; Black? Are you sure? Brad might be wearing his 'negative' goggles today :-) -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] array_push in array maps

2006-05-03 Thread Jay Blanchard
[snip] Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow? $colors = array( 'red' => '#ff', 'green' => 'X00ff00', 'blue' => '#ff' ); [/snip] // Append associative

Re: [PHP] array_push in array maps

2006-05-03 Thread Brad Bonkoski
or white ;-) Stut wrote: Brad Bonkoski wrote: $colors['black'] = '#ff'; Black? Are you sure? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array_push in array maps

2006-05-03 Thread Stut
Brad Bonkoski wrote: $colors['black'] = '#ff'; Black? Are you sure? -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] array_push in array maps

2006-05-03 Thread Stut
Jonas Rosling wrote: Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow? $colors = array( 'red' => '#ff', 'green' => 'X00ff00', 'blue' => '#ff' ); Did you try i

Re: [PHP] array_push in array maps

2006-05-03 Thread chris smith
Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow? $colors = array( 'red' => '#ff', 'green' => 'X00ff00', 'blue' => '#ff' ); Yes. http://www.php.net/array_pus

Re: [PHP] array_push in array maps

2006-05-03 Thread Brad Bonkoski
I don't believe you 'push' to an associative array like this, but if you want to add black for example...just do: $colors['black'] = '#ff'; -Brad Jonas Rosling wrote: Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow

[PHP] array_push in array maps

2006-05-03 Thread Jonas Rosling
Need solve another case regarding array maps. Is it possible to insert more values like with array_push in arrays as bellow? $colors = array( 'red' => '#ff', 'green' => 'X00ff00', 'blue' => '#ff' ); Tanks in advance // Jonas -- PHP Ge

RE: [PHP] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote: > How do I then cycle through this array to build the select box? I > currently use this which works fine when I hard code the values..ie. > $yesno=array("Yes"=>"1","No"=>"0") but doesn't seem to work using your > first option. > > Here is the form selec

RE: [PHP] array_push

2004-05-21 Thread Edward Peloke
rm select box code while($value=each($array)) { $res .= "".$value['key']."\n"; } Thanks, Eddie -Original Message- From: Jeroen Serpieters [mailto:[EMAIL PROTECTED] Sent: Friday, May 21, 2004 12:16 AM To: Edward Peloke Cc: 

Re: [PHP] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote: > > $clients[]=array(); > Here you should probably use $clients = array(); -- Jeroen Anybody who thinks a little 9,000-line program [Java] that's distributed free and can be cloned by anyone is going to affect anything we do at Microsoft has his head

Re: [PHP] array_push

2004-05-21 Thread Jeroen Serpieters
On Fri, 21 May 2004, Edward Peloke wrote: > > $sql=new Database(); > $sql->query("select fname,lname, id from clients"); > $clients[]=array(); > while($sql->nextRecord()){ >array_push($clients, $sql->getField('id')=>$sql->getField('fname')); > } // while > > Parse error: parse error, unexpect

[PHP] array_push

2004-05-21 Thread Edward Peloke
Ok, I am having a brain cramp for some reason but I need to pass in an array to my form class to build select boxes. The array is ("id"=>"John Doe"), I need to dynamically build this array from a query but I am getting errors using array_push.do I need to use array_merge? Example: $sql=new Da

[PHP] array_push

2002-08-27 Thread Michal Dvoracek
Hello, why this array_push($x ? $a : $b, 'value'); produce error(Fatal error: Only variables can be passed by reference) http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] ARRAY_PUSH with $key

2002-07-18 Thread Analysis & Solutions
On Fri, Jul 19, 2002 at 01:58:42AM +0300, Pekka Saarinen wrote: > > I think array_push gets you cleaner lookin code (subjective). It also > ensures you always add to end of the array - good for novices like > me. Array_push is also TWO times faster (academic difference in the speeds > of mode

Re: [PHP] ARRAY_PUSH with $key

2002-07-18 Thread Pekka Saarinen
At 7/18/2002, you wrote: >On Thu, Jul 18, 2002 at 03:40:58PM -0400, Joshua E Minnie wrote: > > Hey all, > > Does anybody know of a way to push an element onto an array with a > > specific key? What I am trying to do is create a dynamically created > > associative array. Here is a sample prin

Re: [PHP] ARRAY_PUSH with $key

2002-07-18 Thread Analysis & Solutions
On Thu, Jul 18, 2002 at 03:40:58PM -0400, Joshua E Minnie wrote: > Hey all, > Does anybody know of a way to push an element onto an array with a > specific key? What I am trying to do is create a dynamically created > associative array. Here is a sample print_r of what an array would look >

[PHP] ARRAY_PUSH with $key

2002-07-18 Thread Joshua E Minnie
Hey all, Does anybody know of a way to push an element onto an array with a specific key? What I am trying to do is create a dynamically created associative array. Here is a sample print_r of what an array would look like: Array ( [default] => css/default.css [forms] => css/forms.cs

Re: [PHP] ARRAY_PUSH()

2002-07-17 Thread Analysis & Solutions
Chris: Why'd you start a second thread on this? See my reply in the "File reading help with Syntax" thread. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.

[PHP] ARRAY_PUSH()

2002-07-17 Thread Chris Crane
I am getting data froma website for stock information. If I type in the brower the URL I get a text file display list this; Date,Open,High,Low,Close,Volume 16-Jul-02,7.92,8.10,7.68,7.82,605500 15-Jul-02,7.98,8.02,7.59,8.02,577200 12-Jul-02,7.80,8.00,7.57,7.95,411100 11-Jul-02,7.82,7.94,7.34,7.80,

Re: [PHP] array_push but with key, value pairs

2001-04-17 Thread Joseph Blythe
Dean Hall wrote > Instead of 'array_push', do this: > > $input[$key] = $val; > Hey thanks dean that did the trick, I was trying: $array[] = $key . "=>" . $val which of course doesn't work hehe. Regards Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EM

Re: [PHP] array_push but with key, value pairs

2001-04-17 Thread Dean Hall
Joseph. "Joseph Blythe" <[EMAIL PROTECTED]> wrote: ... > Ok fine, I now have an associative array with a numeric index, but > hangon I wanted to push the key => value into the array. How would I do > this, I have tried a couple of things but am having some really crazy > results ;-) 'array_push'

Re: [PHP] array_push but with key, value pairs

2001-04-16 Thread Joseph Blythe
Peter Houchin wrote: > what about if you assign the key to = the id (if in a data base)? > > maybe like > > while (list ($key, $val) = each ($id)) { > if ( $key != "Submit" ) { > >>array_push($input, $val); >>} >> >> } > I am not using a database for this part as I am just collect

RE: [PHP] array_push but with key, value pairs

2001-04-16 Thread Peter Houchin
ECTED]] Sent: Tuesday, April 17, 2001 3:40 PM To: Peter Houchin Cc: [EMAIL PROTECTED] Subject: Re: [PHP] array_push but with key, value pairs Peter Houchin wrote: > maybe tring this ... > $input = array(); > > reset ($HTTP_POST_VARS); > > while ( list($key, $v

Re: [PHP] array_push but with key, value pairs

2001-04-16 Thread Joseph Blythe
Peter Houchin wrote: > maybe tring this ... > $input = array(); > > reset ($HTTP_POST_VARS); > > while ( list($key, $val) = each($HTTP_POST_VARS) ) { >if ( $key != "Submit" ) { >array_push($input, $val); >} > > } Hmm, as far as I can see this will just reset the internal pointe

RE: [PHP] array_push but with key, value pairs

2001-04-16 Thread Peter Houchin
t: Tuesday, April 17, 2001 3:13 PM To: [EMAIL PROTECTED] Subject: [PHP] array_push but with key, value pairs Hey all, I was just trying to figure out something that should be quite simple but seems to be eluding me, consider the following: $input = array(); while ( list($key, $v

[PHP] array_push but with key, value pairs

2001-04-16 Thread Joseph Blythe
Hey all, I was just trying to figure out something that should be quite simple but seems to be eluding me, consider the following: $input = array(); while ( list($key, $val) = each($HTTP_POST_VARS) ) { if ( $key != "Submit" ) { array_push($input, $val); } } Ok fine, I now have an a