[PHP] a quick question about array keys

2010-08-31 Thread Tontonq Tontonq
a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] = 307 [308] = 308 ... how can i change keys to 0,1,2,3,.. by faster way (it should like that) Array ( [0] = 300 [1] = 301 [2] = 302 [3] =

Re: [PHP] a quick question about array keys

2010-08-31 Thread Joshua Kehn
Quickest way I can think of would be to do something like $tmp = array(); foreach($old_array as $key = $value) { $tmp[$value] = $key; } But knowing PHP there is probably some array_reverse_keys() function. Regards, -Josh Joshua Kehn |

Re: [PHP] a quick question about array keys

2010-08-31 Thread Ashley Sheridan
On Tue, 2010-08-31 at 18:43 +0300, Tontonq Tontonq wrote: a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] = 307 [308] = 308 ... how can i change keys to 0,1,2,3,.. by faster

Re: [PHP] a quick question about array keys

2010-08-31 Thread la...@garfieldtech.com
The fastest way is going to be array_values(): http://www.php.net/array_values --Larry Garfield On 8/31/10 10:43 AM, Tontonq Tontonq wrote: a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306

Re: [PHP] a quick question about array keys

2010-08-31 Thread Ashley Sheridan
On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote: Quickest way I can think of would be to do something like $tmp = array(); foreach($old_array as $key = $value) { $tmp[$value] = $key; } But knowing PHP there is probably some array_reverse_keys() function. Regards,

Re: [PHP] a quick question about array keys

2010-08-31 Thread Joshua Kehn
On Aug 31, 2010, at 11:46 AM, Ashley Sheridan wrote: On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote: Quickest way I can think of would be to do something like $tmp = array(); foreach($old_array as $key = $value) { $tmp[$value] = $key; } But knowing PHP there is probably

Re: [PHP] a quick question about array keys

2010-08-31 Thread Richard Quadling
On 31 August 2010 16:43, Tontonq Tontonq root...@gmail.com wrote: a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] = 307 [308] = 308 ... how can i change keys to 0,1,2,3,.. by

Re: [PHP] a quick question about array keys

2010-08-31 Thread Tontonq Tontonq
Ty four your all replies i got 9 replies less than 10 minutes :) than can u answer this too my array is like that for now Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] = 307 [308] = 308 [309] = 309 [310] = 310 [311] = 311 [312] = 312 [313] = 313

Re: [PHP] a quick question about array keys

2010-08-31 Thread Ashley Sheridan
On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote: Ty four your all replies i got 9 replies less than 10 minutes :) than can u answer this too my array is like that for now Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] =

Re: [PHP] a quick question about array keys

2010-08-31 Thread Richard Quadling
On 31 August 2010 16:45, Ashley Sheridan a...@ashleysheridan.co.uk wrote: There are two ways I see to do it. You can iterate the array and create a copy, assigning elements dynamic values: $new_array = array(); foreach($array as $a) {    $new_array[] = $a; } or use a sorting function on

Re: [PHP] a quick question about array keys

2010-08-31 Thread Frank Arensmeier
Have a look at the manual, especially the function array_values(). /frank Skickat från min iPhone. 31 aug 2010 kl. 17:43 skrev Tontonq Tontonq root...@gmail.com: a quick question lets say i have an array like that Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304

Re: [PHP] a quick question about array keys

2010-08-31 Thread Ashley Sheridan
On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote: Ty four your all replies i got 9 replies less than 10 minutes :) than can u answer this too my array is like that for now Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] =

Re: [PHP] a quick question about array keys

2010-08-31 Thread Ashley Sheridan
On Tue, 2010-08-31 at 16:58 +0100, Richard Quadling wrote: On 31 August 2010 16:45, Ashley Sheridan a...@ashleysheridan.co.uk wrote: There are two ways I see to do it. You can iterate the array and create a copy, assigning elements dynamic values: $new_array = array(); foreach($array

Re: [PHP] a quick question about array keys

2010-08-31 Thread Richard Quadling
On 31 August 2010 17:06, Tontonq Tontonq root...@gmail.com wrote: Array ( [300] = 300 [301] = 301 [302] = 302 [303] = 303 [304] = 304 [305] = 305 [306] = 306 [307] = 307 [308] = 308 [309] = 309 [310] = 310 [311] = 311 [312] = 312 [313] = 313 [314] = 314 [165] = 165 [166] = 166

Re: [PHP] a quick question about array keys

2010-08-31 Thread Tontonq Tontonq
i think its my mistake it will begin from first value of array it will continue until if its more big than +2 and it 2010/8/31 Ashley Sheridan a...@ashleysheridan.co.uk On Tue, 2010-08-31 at 19:06 +0300, Tontonq Tontonq wrote: Ty four your all replies i got 9 replies less than 10 minutes :)

Re: [PHP] a quick question about array keys

2010-08-31 Thread Richard Quadling
On 31 August 2010 17:39, Richard Quadling rquadl...@gmail.com wrote: On 31 August 2010 17:06, Tontonq Tontonq root...@gmail.com wrote: Array ( [300] = 300 [301] = 301 ... Not sure what happened there! ?php $data = array ( 300 = 300, 301 = 301, 302 = 302,

Re: [PHP] a quick question about array keys

2010-08-31 Thread Richard Quadling
On 31 August 2010 17:49, Richard Quadling rquadl...@gmail.com wrote: On 31 August 2010 17:39, Richard Quadling rquadl...@gmail.com wrote: On 31 August 2010 17:06, Tontonq Tontonq root...@gmail.com wrote: Array ( [300] = 300 [301] = 301 ... If you add a ... sort($data) ... just before the

[PHP] Re: quick question about using capital letters coding w/ PHP

2005-07-24 Thread Matthew Weier O'Phinney
* Bruce Gilbert [EMAIL PROTECTED]: I am well versed in coding with xhtml which requires all lower case and am pretty much a newbie at PHP so that is why I am asking this question. is this acceptible if ($_post [sender_email] == ) or does at have to be if ($_POST [sender_email] == ) in

[PHP] Re: quick question

2004-06-19 Thread water_foul
I would also like to know how to set a cookie to all dirs in a domain how do you set a system path to the top level, i allredy tried '/' but it ignores the last '. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Quick question: PHP user?

2003-10-10 Thread Curt Zirzow
On Fri, 10 Oct 2003 16:44:37 -0500, Grant Rutherford [EMAIL PROTECTED] wrote: Hi, Just a quick question... What user does php run as on linux? Is it the Apache user? Is there some way to tell? I need to be able to set a directory so that only PHP can access it. You can figure who

[PHP] A quick question - Help Please !

2002-08-19 Thread Dan McCullough
Hello everyone, I have a quick question. I am trying to do two seperate things on one submission, it would be easy if I was submitting to my own page, but I am submitting to a payment processor company, and so several things will occur off-site, and there is nothing that comes back from the

Re: [PHP] A quick question - Help Please !

2002-08-19 Thread Justin French
That's REALLY strange that the payment site doesn't return anything... So the user just hits a dead-end or what? Can we see a test site? And the fact that it all needs to be secure makes it a little more challenging. Essentially, what you need is for one form to POST to two separate

Re: [PHP] A quick question - Help Please !

2002-08-19 Thread Adrian Murphy
McCullough [EMAIL PROTECTED]; PHP General List [EMAIL PROTECTED] Sent: Monday, August 19, 2002 3:09 PM Subject: Re: [PHP] A quick question - Help Please ! That's REALLY strange that the payment site doesn't return anything... So the user just hits a dead-end or what? Can we see a test site

RE: [PHP] A quick question - Help Please !

2002-08-19 Thread Trout, Travis
for sending the information to the remote server? Travis Trout -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 10:48 AM To: Dan McCullough; PHP General List Subject: Re: [PHP] A quick question - Help Please ! to do it with javascript u could

RE: [PHP] A quick question - Help Please !

2002-08-19 Thread Dan McCullough
? Travis Trout -Original Message- From: Adrian Murphy [mailto:[EMAIL PROTECTED]] Sent: Monday, August 19, 2002 10:48 AM To: Dan McCullough; PHP General List Subject: Re: [PHP] A quick question - Help Please ! to do it with javascript u could post the form to another local page

[PHP] Re: quick question

2002-08-15 Thread Bogdan Stancescu
http://www.php.net/manual/en/ref.classobj.php Chris Barnes wrote: hey people, I have been seeing something in a few php scripts i've been playing with and i really dont know what it means or does. I'm only new to php so maybe someone could explain. i have been seeing -...e.g. while($file

[PHP] explode() - quick question

2002-03-13 Thread Phil Schwarzmann
Im trying to take this string, hello, and explode it into an array with each cell in the array containing one character. $array[0] = 'h' $array[1] = 'e' etc.. How does this work? When is use... $character = explode('', $string) or $character = explode($string) ...it doesn't seem to work.

Re: [PHP] explode() - quick question

2002-03-13 Thread Analysis Solutions
On Wed, Mar 13, 2002 at 10:06:01PM -0500, Phil Schwarzmann wrote: $array[0] = 'h' $array[1] = 'e' $character = explode('', $string) or You need to explode the array: $character = explode('', $array); --Dan -- PHP scripts that make your job easier

RE: [PHP] explode() - quick question

2002-03-13 Thread Martin Towell
just use $string{0} and $string{1} , etc. note the type of brackets -Original Message- From: Phil Schwarzmann [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 14, 2002 2:06 PM To: [EMAIL PROTECTED] Subject: [PHP] explode() - quick question Im trying to take this string, hello

[PHP] a quick question..

2002-01-27 Thread Tauntz
If I have n variables: $nr1 = some text; $nr2 = some other text $nr3 and I want to print the text randomly (like if I enter the page.. it displays $nr1... next time it displays $nr 5.. etc) how can I achieve it ? [EMAIL PROTECTED]

Re: [PHP] a quick question..

2002-01-27 Thread Miles Thompson
Try this: Store variables in an array, say $msg_array. (For those of Hungarian preference, $arrMessages.) $index = rand (0, $n) echo $msg_array[ $index ] Now this will require a bit of messing about, seeding the randomizer, etc., but you get the idea. Miles Thompson On Sunday 27 January

Re: [PHP] a quick question..

2002-01-27 Thread Edward van Bilderbeek - Bean IT
Or, if you've already set your massive list of variables...: $varname = nr.rand(0, $n); print ${$varname}; - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: Tauntz [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, January 27, 2002 8:15 PM Subject: Re: [PHP] a quick

Re: [PHP] a quick question..

2002-01-27 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Tauntz blurted If I have n variables: $nr1 = some text; $nr2 = some other text $nr3 and I want to print the text randomly (like if I enter the page.. it displays $nr1... next time it displays $nr 5.. etc) how can I

Re: [PHP] a quick question..

2002-01-27 Thread Miles Thompson
Even better! mt On Sunday 27 January 2002 03:27 pm, you wrote: * and then Tauntz blurted If I have n variables: $nr1 = some text; $nr2 = some other text $nr3 and I want to print the text randomly (like if I enter the page.. it displays $nr1... next time it displays

Re: [PHP] a quick question..

2002-01-27 Thread Tauntz
Thank you, it worked :) - Original Message - From: Nick Wilson [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 27, 2002 9:27 PM Subject: Re: [PHP] a quick question.. -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Tauntz blurted If I have n variables

Re: [PHP] a quick question..

2002-01-27 Thread Paul A. Procacci
He meant push Nick Wilson wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Tauntz blurted If I have n variables: $nr1 = some text; $nr2 = some other text $nr3 and I want to print the text randomly (like if I enter the page.. it displays $nr1... next

Re: [PHP] a quick question..

2002-01-27 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Paul A. Procacci blurted He meant push Hehe, I didn't think of that. Actually I didn't mean push /or/ pop in the array sense of the word, I meant *put* as in create! I'll take more care in future :-) - -- Nick Wilson Tel:+45

[PHP] Re: Quick question about no result

2001-11-15 Thread Richard Lynch
Dan McCullough wrote: I want to show a default piece of information if my query returns no result, and what I mean by no result is the query for a store in a certain state doesnt exist. http://php.net/mysql_num_rows (Or sybase_num_rows, or odbc_num_rows, or whatever your database is.) If 0

Re: [PHP] one quick question: how do I assign atring value into variable?

2001-01-31 Thread David Robley
On Fri, 2 Feb 2001 04:03, [EMAIL PROTECTED] wrote: Folks, The title is my question, how do I assign strign value into variables? Say , is the syntax below correct? if ($singleRooms==1) { $roomType ='Single Room'; }elseif ($singleRooms==2) { }else{ $roomType='Room Type