RE: [PHP] in_array - what the...

2010-06-25 Thread Bob McConnell
From: Peter Lind > On 25 June 2010 19:58, Bob McConnell wrote: >> From: Daevid Vincent >> >>> Why do this "in_array()" business?? >>> >>> Just do this... >>> >>> if (self::$aboveArray[$name]) >>> { >>>    //something interesting here >>> } >> >> Does that gibberish actually do something? It doesn

Re: [PHP] in_array - what the...

2010-06-25 Thread Peter Lind
On 25 June 2010 19:58, Bob McConnell wrote: > From: Daevid Vincent > >> Why do this "in_array()" business?? >> >> Just do this... >> >> if (self::$aboveArray[$name]) >> { >>    //something interesting here >> } > > Does that gibberish actually do something? It doesn't make any sense to > me, while

RE: [PHP] in_array - what the...

2010-06-25 Thread Bob McConnell
From: Daevid Vincent > Why do this "in_array()" business?? > > Just do this... > > if (self::$aboveArray[$name]) > { >//something interesting here > } Does that gibberish actually do something? It doesn't make any sense to me, while in_array() actually looks like what it does. Bob McConne

RE: [PHP] in_array - what the...

2010-06-25 Thread Daevid Vincent
> -Original Message- > From: Gary . [mailto:php-gene...@garydjones.name] > Sent: Friday, June 25, 2010 1:14 AM > To: PHP > Subject: Re: [PHP] in_array - what the... > > "Ford, Mike" writes: > >> -Original Message- > >>

RE: [PHP] in_array - what the...

2010-06-25 Thread Ford, Mike
> -Original Message- > From: Gary . [mailto:php-gene...@garydjones.name] > Sent: 25 June 2010 09:14 > To: PHP > Subject: Re: [PHP] in_array - what the... > > "Ford, Mike" writes: > >> -Original Message- > >>

Re: [PHP] in_array - what the...

2010-06-25 Thread Gary .
"Ford, Mike" writes: >> -Original Message- >> If I have an array that looks like >> array(1) { >> ["mac_address"]=> >> string(2) "td" >> } >> >> and I call >> if (in_array($name, self::$aboveArray)) >> with $name as >> string(11) "mac_address" >> >> what should be the result

RE: [PHP] in_array - what the...

2010-06-25 Thread Ford, Mike
> -Original Message- > From: Gary . [mailto:php-gene...@garydjones.name] > Sent: 25 June 2010 08:18 > To: PHP > Subject: [PHP] in_array - what the... > > If I have an array that looks like > array(1) { > ["mac_address"]=> > string(2) "td" > } > > and I call > if (in_array($n

Re: [PHP] in_array breaks down for 0 as value

2008-11-21 Thread Stut
On 22 Nov 2008, at 00:06, Ashley Sheridan wrote: On Fri, 2008-11-21 at 09:11 +, Stut wrote: On 20 Nov 2008, at 23:09, Ashley Sheridan wrote: On Thu, 2008-11-20 at 09:25 +, Stut wrote: On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: I wanted to use in_array to verify the results of a fo

Re: [PHP] in_array breaks down for 0 as value

2008-11-21 Thread Ashley Sheridan
On Fri, 2008-11-21 at 09:11 +, Stut wrote: > On 20 Nov 2008, at 23:09, Ashley Sheridan wrote: > > On Thu, 2008-11-20 at 09:25 +, Stut wrote: > >> On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: > >>> I wanted to use in_array to verify the results of a form submission > >>> for a checkbox an

Re: [PHP] in_array breaks down for 0 as value

2008-11-21 Thread Stut
On 20 Nov 2008, at 23:09, Ashley Sheridan wrote: On Thu, 2008-11-20 at 09:25 +, Stut wrote: On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: I wanted to use in_array to verify the results of a form submission for a checkbox and found an interesting behaviour. $ php -v PHP 5.2.5 (cli) (built

Re: [PHP] in_array breaks down for 0 as value

2008-11-20 Thread Lars Torben Wilson
2008/11/20 Stut <[EMAIL PROTECTED]>: > On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: >> >> I wanted to use in_array to verify the results of a form submission >> for a checkbox and found an interesting >> behaviour. >> >> $ php -v >> PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37) >> $ >> >> $ cat

Re: [PHP] in_array breaks down for 0 as value

2008-11-20 Thread Ashley Sheridan
On Thu, 2008-11-20 at 09:25 +, Stut wrote: > On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: > > I wanted to use in_array to verify the results of a form submission > > for a checkbox and found an interesting > > behaviour. > > > > $ php -v > > PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37) > >

Re: [PHP] in_array breaks down for 0 as value

2008-11-20 Thread Stut
On 20 Nov 2008, at 06:55, Yashesh Bhatia wrote: I wanted to use in_array to verify the results of a form submission for a checkbox and found an interesting behaviour. $ php -v PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37) $ $ cat in_array2.php 'page', 'story' =>

Re: [PHP] in_array breaks down for 0 as value

2008-11-19 Thread Lars Torben Wilson
2008/11/19 Yashesh Bhatia <[EMAIL PROTECTED]>: > Hi. > > I wanted to use in_array to verify the results of a form submission > for a checkbox and found an interesting > behaviour. > > $ php -v > PHP 5.2.5 (cli) (built: Jan 12 2008 14:54:37) > $ > > $ cat in_array2.php > $node_review_types = array

Re: [PHP] in_array() related problem

2006-11-05 Thread tamcy
Hi, Thanks for your reply. After a sleep overnight I found I said something really stupid. Arrays are compared in deep, and also for objects. I really forgot the old PHP4 way and thought PHP5 compares object simply by address when using ==, which is not the real case. I need to use === for compar

Re: [PHP] in_array() related problem

2006-11-04 Thread Tom Atkinson
Try like this: var_dump(in_array($a, $test, true)); Richard Lynch wrote: Try providing a custom comparison function. Almost for sure, PHP is attempting to "test" the == by a deeper scan than you think. On Fri, November 3, 2006 10:56 am, tamcy wrote: Hello all, I'm new to this list. To not

Re: [PHP] in_array() related problem

2006-11-03 Thread Richard Lynch
Try providing a custom comparison function. Almost for sure, PHP is attempting to "test" the == by a deeper scan than you think. On Fri, November 3, 2006 10:56 am, tamcy wrote: > Hello all, > > I'm new to this list. To not flooding the bug tracking system I hope > to clarify some of my understand

Re: [PHP] in_array w/statement

2004-12-16 Thread Sebastian
To: <[EMAIL PROTECTED]> Sent: Thursday, December 16, 2004 3:39 PM Subject: Re: [PHP] in_array w/statement > On Friday 17 December 2004 02:33, Sebastian wrote: > > > I cannot solve this problem,. sorry if this looks confusing,. > > It is ... > > > i have a form

Re: [PHP] in_array w/statement

2004-12-16 Thread Matt M.
> reason it seems to always be true, ... something i'm doing wrong? btw, i > cannot add the in_array to the statement because if the $buddylist is empty > it will generate errors because of the empty implode. you could add the is_array() check. > $buddylist = preg_split('/( )+/', trim($userinfo['

Re: [PHP] in_array w/statement

2004-12-16 Thread Jason Wong
On Friday 17 December 2004 02:33, Sebastian wrote: > I cannot solve this problem,. sorry if this looks confusing,. It is ... > i have a form and don't want to set the variable if the in_array is true.. > the code works, up until i add the last !$buddy in the statement, for some > reason it seems

Re: [PHP] in_array not operating as 'expected'

2004-11-09 Thread Marek Kilimajer
Ing. Ivo F.A.C. Fokkema wrote: Hi guys and gals, I'm not screaming "Bug! Bug!" but this _does_ look 'illogical' to me. I've searched the archives, but found no earlier conversation. Sorry if I missed it. Consider the following code: var_dump(in_array('test', array(0))); What does this return? I exp

Re: [PHP] in_array()/finding page Problem

2003-10-23 Thread Marek Kilimajer
Ben G. McCullough wrote: I agree - my solution is VERY resource intensive, but I think I may have over simplified my question. Each item is listed by two categories, $medium and $period. Users can get to the item via a 'browse' of either category. I want to user to be able to get back to the

Re: [PHP] in_array()/finding page Problem

2003-10-23 Thread Marek Kilimajer
You solution is quite resource expensive. I would do: [find $maxpages] SELECT COUNT(*)/12 FROM table WHERE id <= $real_id; list($maxpages) = fetch_row() In result.php use "ORDER BY id" Ben G. McCullough wrote: I think I have a flaw of logic in trying to find the correct page in a mutli-page sql

Re: [PHP] in_array()

2002-08-22 Thread jochen schultz
Hi Riccardo, >if(mysql_num_rows($rty->resu)) { //result >$rec = mysql_fetch_array($rty->resu); > if(!isset($_SESSION["bkmks"]) || When you save something for the first time, the element of $_SESSION["bkmks"] is a string and you can compa

RE: [PHP] in_array problems (another pair of eyes?)

2002-05-22 Thread Johnson, Kirk
Unless you are using PHP version 4.2 or higher, the first argument can't be an array. Kirk > -Original Message- > From: Jas [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 21, 2002 11:46 AM > To: [EMAIL PROTECTED] > Subject: [PHP] in_array problems (another pair of eyes?) > > > I don't

Re: [PHP] in_array problems (another pair of eyes?)

2002-05-21 Thread Jason Wong
On Wednesday 22 May 2002 01:45, Jas wrote: > I don't think I am using the syntax correctly, I have been looking at this > function on php.net and everything I have seen says my code should be > working. What version of php are you using? In PHP versions before 4.2.0 needle was not allowed to be

Re: [PHP] in_array algorithm

2002-02-06 Thread Lars Torben Wilson
On Wed, 2002-02-06 at 08:26, John Fulton wrote: > > Does anyone know which algorithm in_array() uses? > > For example, if I say > > in_array("foo", $arr) > > Does in_array() do an unordered sequential serach of $arr for > "foo" which takes up to n comparisons [where n = count($arr)], > or d

Re: [PHP] in_array error

2001-11-29 Thread Fred
Steve Osborne" <[EMAIL PROTECTED]>; "PHP-General > (E-mail)" <[EMAIL PROTECTED]> > Sent: Thursday, November 29, 2001 11:29 AM > Subject: RE: [PHP] in_array error > > > > Steve, > > > > What version of PHP are you running. in_ar

Re: [PHP] in_array error

2001-11-29 Thread Steve Osborne
ECTED]> Sent: Thursday, November 29, 2001 11:29 AM Subject: RE: [PHP] in_array error > Steve, > > What version of PHP are you running. in_array is >= 4.0. is_array was in 3.0 > so this may be an issue for you. > > Gerard > > -Original Message- > From: Steve

RE: [PHP] in_array error

2001-11-29 Thread Gerard Onorato
Steve, What version of PHP are you running. in_array is >= 4.0. is_array was in 3.0 so this may be an issue for you. Gerard -Original Message- From: Steve Osborne [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 3:08 PM To: PHP-General (E-mail) Subject: [PHP] in_array error

Re: [PHP] in_array

2001-09-13 Thread David Otton
On Thu, 13 Sep 2001 14:17:12 +0300, you wrote: >i wrote php scripts with php 4. but my server's php version is php 3. i >used in_array function while i was writing the scripts. i used that >function to check posted variables is available or not. >is there an another way to check this posted var

Re: [PHP] in_array() with associate array?

2001-07-31 Thread Brian White
in_array is for testing that a value exists in an array. What you want is if ( isset( $some_array[some_key] ) ) print "HAS KEY"; else print "DOESN'T HAVE KEY"; At 14:23 31/07/2001 -0400, Jaxon wrote: >hi, > >in_array is confusing me :) > >can someone show me an example of how to test if

RE: [PHP] in_array() function not supported on my server... anything else?

2001-04-26 Thread Maxim Maletsky
yeah.. the loop. see php.net/arrays most of the coolest array functions were introduced in PHP4 if you are trying to make a dynamic portable application you might want to look into phpversion(); this will tell you which version it runs, and based on that will select the best way to find the re

Re: [PHP] in_array() with multidimensional array

2001-03-09 Thread Chris Lee
recusrion is your friend. $val) { if (is_array($val)) { if (in_multi_array($needle, $val)) return 1; } else if ($val == $needle) return 1; } } if (in_multi_array('d', $test)) echo "TRUE \n"; else echo "FALSE \n"; ?> -- Chris Lee Mediawaveonline.com