Re: [PHP] Re: Array Search - Solved

2011-03-26 Thread Ethan Rosenberg
At 01:31 PM 3/25/2011, João Cândido de Souza Neto wrote: It´s a job to array_key_exists function. -- João Cândido de Souza Neto "Ethan Rosenberg" escreveu na mensagem news:0lim00hi3ihny...@mta4.srv.hcvlny.cv.net... > Dear List - > > Here is a code snippet: > > $bla = array("g1" => $r

Re: [PHP] Re: array to var - with different name

2011-01-21 Thread Shawn McKenzie
On 01/20/2011 05:26 PM, Tommy Pham wrote: > On Thu, Jan 20, 2011 at 2:49 PM, Shawn McKenzie wrote: >> On 01/20/2011 04:28 PM, Donovan Brooke wrote: >>> Hello again! >>> >>> I'm trying to find a good way to convert array key/value's to >>> variable name values... but with the caveat of the name b

Re: [PHP] Re: array to var - with different name

2011-01-20 Thread Tommy Pham
On Thu, Jan 20, 2011 at 2:49 PM, Shawn McKenzie wrote: > On 01/20/2011 04:28 PM, Donovan Brooke wrote: >> Hello again! >> >> I'm trying to find a good way to convert array key/value's to >> variable name values... but with the caveat of the name being >> slightly different than the original key >>

Re: [PHP] Re: array or list of objects of different types

2010-04-03 Thread Peter Pei
var_dump( array( true , 12 , "php already does this" ) ); array(3) { [0]=> bool(true) [1]=> int(12) [2]=> string(21) "php already does this" } :) Yeah. But this feature of PHP is a boon if used carefully and a curse if careless. You can get AMAZING results if you're not caref

Re: [PHP] Re: array or list of objects of different types

2010-04-02 Thread Nilesh Govindarajan
On 04/03/10 05:42, Nathan Rixham wrote: Php Developer wrote: Hi all, I want to be able to have an array of elements of different types. As an example: the first element is a boolean, the second is an integer, and the thirs is a string. In php there is no typing, i'm just wondering if there i

Re: [PHP] Re: Array

2009-08-10 Thread Jim Lucas
Robert Cummings wrote: > Colin Guthrie wrote: >> 'Twas brillig, and Jim Lucas at 10/08/09 16:29 did gyre and gimble: >>> $d = array( >>> "home_page", >>> "member_services", >>> "member_services_login", >>> "network", >>> "resource_center", >>> "verse_of_the_day_activate", >>

Re: [PHP] Re: Array

2009-08-10 Thread Robert Cummings
Colin Guthrie wrote: 'Twas brillig, and Jim Lucas at 10/08/09 16:29 did gyre and gimble: $d = array( "home_page", "member_services", "member_services_login", "network", "resource_center", "verse_of_the_day_activate", ); Ahh someone else who alway

Re: [PHP] Re: array recursion from database rows

2008-05-25 Thread Larry Garfield
On Saturday 24 May 2008, Chris W wrote: > Bob wrote: > > Hi. > > > > I have a database table I have created for navigation. > > > > The table fields are uid, parent_id, menu_name. > > > > Each entry is either a top level element with a parent_id of 0 or a child > > which has a parent_id that relate

RE: [PHP] Re: array variables with or without quotes

2006-02-22 Thread Jason Karns
I believe it is because without the quotes, it is expecting a predefined constant. With the quotes, it is expecting an array key. This is why if you use a word that is not defined as a constant, php will first look for it as a constant, won't find it, then looks through the array treating it like

Re: [PHP] Re: Array sizes?

2006-02-08 Thread Anders Norrbring
Rory Browne skrev: At 01:05 AM 2/8/2006, Barry wrote: I don't think a "function" exists, but i would probably use (for benchmarking) a recursive foreach in combination with strlen. And add it all up. (This is probably some work for the PC so that's why benchmarking) It would be interesting to

Re: [PHP] Re: Array sizes?

2006-02-08 Thread Rory Browne
> At 01:05 AM 2/8/2006, Barry wrote: > >I don't think a "function" exists, but i would probably use (for > >benchmarking) a recursive foreach in combination with strlen. > >And add it all up. > >(This is probably some work for the PC so that's why benchmarking) > > > It would be interesting to know

Re: [PHP] Re: Array sizes?

2006-02-08 Thread Barry
Paul Novitski wrote: Anders Norrbring wrote: Maybe I'm just blind, but I can't find any way to count an array size in bytes? I have a quite big array with multiple data formats in it, and I would like to know how big it is in bytes... At 01:05 AM 2/8/2006, Barry wrote: I don't think a "fu

Re: [PHP] Re: Array sizes?

2006-02-08 Thread Paul Novitski
Anders Norrbring wrote: Maybe I'm just blind, but I can't find any way to count an array size in bytes? I have a quite big array with multiple data formats in it, and I would like to know how big it is in bytes... At 01:05 AM 2/8/2006, Barry wrote: I don't think a "function" exists, but i wou

Re: [PHP] Re: array of checkbox values

2006-01-11 Thread Philip Hallstrom
Would it be enough to set a key for each checkbox, for example explicitly say: checkbox[1] checkbox[2] checkbox[3] then a non checked box will have an empty string as a value, whereas the checked ones will have a value of 'Y'. Nope. That's the problem. If a checkbox is unchecked the browser do

Re: [PHP] Re: array carrying from one php page to another

2005-12-09 Thread Jochem Maas
Ford, Mike wrote: On 08 December 2005 16:47, Sandy Keathley wrote: ... . . $_SESSION['array'] = serialize($array); Why on earth would you want to serialize an array you're adding to the session? That's just a terrible waste of good machine cycles. terrible, very. too many hits to the

RE: [PHP] Re: array carrying from one php page to another

2005-12-09 Thread Ford, Mike
On 08 December 2005 16:47, Sandy Keathley wrote: > > I have an array $journal that I want to carry from a page (where it > > was created) to another page (a popup that shows the variables > > contents). Is this automatically available? or do I have to do > > something special to php?? > > One wa

Re: [PHP] Re: Array Losing value

2004-07-20 Thread Justin Patrin
On Tue, 20 Jul 2004 10:50:04 -0500 (CDT), Jonathan Villa <[EMAIL PROTECTED]> wrote: > nevermind, I found a work around for it... > > I still would like to know why the value is lost. > What's the "work-around"? -- DB_DataObject_FormBuilder - The database at your fingertips http://pear.php.net/

Re: [PHP] Re: Array Losing value

2004-07-20 Thread Jonathan Villa
nevermind, I found a work around for it... I still would like to know why the value is lost. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Re: Array Losing value

2004-07-20 Thread Jonathan Villa
>> >> if I die(sizeof($objDBI->Fetch_Array($objDBI->getResultID( within >> the >> DBI method, it return the correct value, however if I do >> >> $retval = $objDBI->Fetch_Array($objDBI->getResultID()); >> die(sizeof($retVal)); > > $retval != $retVal > > -- > PHP General Mailing List (http://www.

Re: [PHP] Re: Array Sorting Headaches

2004-04-19 Thread Torsten Roehr
> > OK, so it's just the other way round - I see. Instead of deleting the entry > > with the highest expiry date we delete all the others: > > > > foreach ($foo as $key => $value) { > > > > $tempArray = array(); > > > > foreach ($value as $subkey => $subvalue) { > > > >

Re: [PHP] Re: Array Sorting Headaches

2004-04-19 Thread Burhan Khalid
Torsten Roehr wrote: Well, it does some sorting, but not quite what I'm after :( I've managed to get the list so that all the (sub) entries are sorted in the correct order. Now its just a matter of finding the highest expire date for /each/ domain, and delete the other entries for that domain. S

Re: [PHP] Re: Array Sorting Headaches

2004-04-19 Thread Torsten Roehr
> Well, it does some sorting, but not quite what I'm after :( > > I've managed to get the list so that all the (sub) entries are sorted in > the correct order. Now its just a matter of finding the highest expire > date for /each/ domain, and delete the other entries for that domain. > So, in the e

Re: [PHP] Re: Array Sorting Headaches

2004-04-19 Thread Burhan Khalid
Torsten Roehr wrote: "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Torsten Roehr wrote: "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Greetings everyone : Having a hard time with this one. I have a multi-dim array $foo[$x][$y]['key']

Re: [PHP] Re: Array Sorting Headaches

2004-04-19 Thread Torsten Roehr
"Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Torsten Roehr wrote: > > > "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > >>Greetings everyone : > >> > >> Having a hard time with this one. I have a multi-dim array > >>$foo[$x][$

Re: [PHP] Re: Array Sorting Headaches

2004-04-18 Thread Burhan Khalid
Torsten Roehr wrote: "Burhan Khalid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Greetings everyone : Having a hard time with this one. I have a multi-dim array $foo[$x][$y]['key'], where $x and $y are numeric. Here is some sample data [ snipped ] I need to filter the results

RE: [PHP] Re: array block

2004-01-31 Thread Shawn McKenzie
'href' => 'foo', 'title' => 'bar', 'style' => 'amet' ) ); foreach ($menu as $array) { $tag = " $v) { $tag .= " $k=\"$v\"&

Re: [PHP] Re: array block

2004-01-31 Thread Brian V Bonini
On Fri, 2004-01-30 at 22:48, Shawn McKenzie wrote: > You would need to give an example of what you mean by change dynamically, > because if you can't predict the key indexes then how can you know which > ones to use in your anchor tag? say this: $menu = array ( 'link1' => array(

Re: [PHP] Re: array block

2004-01-31 Thread Jason Wong
On Saturday 31 January 2004 11:48, Shawn McKenzie wrote: > You would need to give an example of what you mean by change dynamically, > because if you can't predict the key indexes then how can you know which > ones to use in your anchor tag? foreach ($arr as $key => $value) { echo "Key: $k

Re: [PHP] Re: array block

2004-01-30 Thread Shawn McKenzie
You would need to give an example of what you mean by change dynamically, because if you can't predict the key indexes then how can you know which ones to use in your anchor tag? -Shawn "Brian V Bonini" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (htt

Re: [PHP] Re: array block

2004-01-30 Thread Brian V Bonini
On Fri, 2004-01-30 at 18:47, Shawn McKenzie wrote: > Sorry, $k should be $text. > > foreach ($menu as $text => $array) { > $url = $array['url']; > $title = $array['title']; > > echo "$text\n"; > } > Gotcha, thanks! That'll work for this but for arguments sake what if the inner array were to

RE: [PHP] Re: ARRAY, IF & INSERT

2002-06-24 Thread César Aracena
> the name <> 0 was a sql-query - it will return a ressource which will > enable you to make something like > > $i=0; > while($row = mysql_fetch_assoc($nameless_result){ > > #psuedo-code# > # mysql_query=("insert into table set relativenumber = 'jr$i' where > ID=$row["ID"]"); > } [César L. Arac

Re: [PHP] Re: ARRAY, IF & INSERT

2002-06-23 Thread Jesper Brunholm
César aracena wrote: > The catch would be to make PHP to auto assign the relatives "level" by > knowing it has to start from $i=1 and loop $i++ until no other kid is > inserted. Now that I write it, it seems I could use a for loop, but what > should be the structure of it using the $name <> 0 you

RE: [PHP] Re: ARRAY, IF & INSERT

2002-06-21 Thread César Aracena
Thanks for the input. I wasn't considering the possibility of making a new table for kids until now which seems pretty logic when trying to save space. The only thing missing now is how to assign a unique relation number for each kid/relative. That's 1 for the first born, 2 for the second one, etc

Re: [PHP] Re: array - change elements position

2002-04-25 Thread Evandro Sestrem
This is what I was looking for! Thank you very much. "Miguel Cruz" <[EMAIL PROTECTED]> escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 25 Apr 2002, Evandro Sestrem wrote: > > My example wasn't good. > > > > I have a array of objects and want change its positions. > >

Re: [PHP] Re: array - change elements position

2002-04-25 Thread Miguel Cruz
On Thu, 25 Apr 2002, Evandro Sestrem wrote: > My example wasn't good. > > I have a array of objects and want change its positions. > > $array = (obj2, obj1, obj3) --> $array = (obj1, obj2, obj3). > > Like TStringList.Exchange in Delphi. > > Sort() don't work in this case, because I want sort

Re: [PHP] Re: array - change elements position

2002-04-25 Thread Pushkar Pradhan
Have you thought about swapping the elements, it's quite simple, I don't know about more complicated methods using pointers here's the code: $layer is the array - $currPos = array_search($HTTP_POST_VARS["selLayer"], $layer); $temp = $layer[$currPos]; $layer[$currPos] = $layer[$cu

Re: [PHP] re: array question

2001-09-18 Thread Scott
Thank YOU! It worked wonderful, I used a blank to separate the content like this: $displn = implode("",$new_data); Thank you again and thank you to everyone for helping me through this! At 01:15 PM 9/19/2001 +0930, David Robley wrote: >On Wed, 19 Sep 2001 12:28, Scott wrote: > > That works, t

Re: [PHP] re: array question

2001-09-18 Thread David Robley
On Wed, 19 Sep 2001 12:28, Scott wrote: > That works, thank you, but it prints at the top of my page, is there > a way to store that array into a single variable? > Yes - implode() -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders Uni

RE: [PHP] re: array question

2001-09-18 Thread Hoover, Josh
If you want to store all the values in the array in one variable (just as a string with delimiters maybe?) Try this: foreach ($array as $value) { $temp .= $value . "|"; } Josh Hoover KnowledgeStorm, Inc. [EMAIL PROTECTED] Searching for a new IT solution for your company? Need to improve

Re: [PHP] re: array question

2001-09-18 Thread Scott
;[EMAIL PROTECTED]> >To: "Scott" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Tuesday, September 18, 2001 7:29 PM >Subject: RE: [PHP] re: array question > > > > perhaps i'm misunderstanding you, but why not use a for loop? > > > > fo

Re: [PHP] re: array question

2001-09-18 Thread Jason Bell
= $value"; } - Original Message - From: "Jack Dempsey" <[EMAIL PROTECTED]> To: "Scott" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, September 18, 2001 7:29 PM Subject: RE: [PHP] re: array question > perhaps i'm misunderstanding you,

RE: [PHP] re: array question

2001-09-18 Thread Scott
Jack- Thanks for the response, but I don't want to echo the array, I want to bundle it into a new variable that will be called as part of a str_replace. The array is created from a loop through all the navigation items in a database. The code is below, if I echo the code is formatted in the wron

RE: [PHP] re: array question

2001-09-18 Thread Jack Dempsey
perhaps i'm misunderstanding you, but why not use a for loop? for($i=0;$imailto:[EMAIL PROTECTED]] Sent: Tuesday, September 18, 2001 10:11 PM To: [EMAIL PROTECTED] Subject: [PHP] re: array question Oh, that works wonders and for the first time in 24 hours I am smiling! One more thing to make i

Re: [PHP] Re: array question

2001-07-19 Thread Ryan Fischer
You wrote: > Also, consider using print or echo as opposed to printf. And lastly, you > really don't need to use mysql_free_result, PHP does this automagically > after the script dies. Sorry for picking on you, you may have your > reasons. ;-) Really? Then why was it that, when I neglected to