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)

[PHP] in_array - what the...

2010-06-25 Thread Gary .
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? Because it is *false* and it is driving me nuts! This despite the fact that if I d

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

[PHP] in_array breaks down for 0 as value

2008-11-19 Thread Yashesh Bhatia
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 'page', 'story' => 'story', 'noder

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

[PHP] in_array() related problem

2006-11-03 Thread tamcy
Hello all, I'm new to this list. To not flooding the bug tracking system I hope to clarify some of my understanding here. I am referring to the (now bogus) bug report http://bugs.php.net/bug.php?id=39356&edit=2. This happens after my upgrade to PHP 5.2, where the code shown produces a "Fatal err

[PHP] in_array and annidated path

2005-04-11 Thread kioto
Hi all sory for the double post but i have deleted the first email that i have send to the list. The problem that i have found is that in_array function don't work with annidate path. I have created a function that update a list of filepath from a directory to DB but when i use particular path w

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

[PHP] in_array w/statement

2004-12-16 Thread Sebastian
Hi, I cannot solve this problem,. sorry if this looks confusing,. 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 to always be true, ... something i'm doing wrong? btw, i cannot add

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

[PHP] in_array not operating as 'expected'

2004-11-09 Thread Ing. Ivo F.A.C. Fokkema
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 expect bool(false), but it retu

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

[PHP] in_array()/finding page Problem

2003-10-23 Thread Ben G. McCullough
I think I have a flaw of logic in trying to find the correct page in a mutli-page sql result. Goal - find the correct page [results.php?page=x] when linking from another page. Current method - loop through a pagination function looking for the matching $id in an array [simplified for illustrat

[PHP] in_array

2002-08-22 Thread Riccardo Sepe
jochen schultz wrote: > 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 > $_SESSI

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

[PHP] in_array()

2002-08-22 Thread Riccardo Sepe
Hi every1 I got this script that works fine on my local windows pc but on the remote server (FreeBSD) I get this message: Warning: Wrong datatype for first argument in call to in_array in /usr/local/.. the script should bookmark an user choice storing it in the $_SESSION["bkmks"] array. t

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

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

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

2002-05-21 Thread Jas
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. A form allows the user to upload a file: Resulting file (upload_done.php): And here is my error: Warning: Wrong datatype for first arg

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

[PHP] in_array algorithm

2002-02-06 Thread John Fulton
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 does it do a binary search which takes about lg(n) comparisons? Is

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 er

[PHP] in_array error

2001-11-29 Thread Steve Osborne
Can anyone explain why I am getting the following error? Fatal error: Call to unsupported or undefined function in_array() in includes/chinlib21stCentury.inc on line 3131 Code: if( (is_array($List)) AND (is_array($RemoveList)) ) { $ListItems = count($List); sort($List); for($ListItem=0;

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

[PHP] in_array

2001-09-13 Thread murat
hi, 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 variables or another one likes in_array function?

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

[PHP] in_array() with associate array?

2001-07-31 Thread Jaxon
hi, in_array is confusing me :) can someone show me an example of how to test if $some_array[some_key] actually has a value, without outputting the value? tia, jaxon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail

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

2001-04-26 Thread Maxim Maletsky
results on any server. Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: Richard [mailto:[EMAIL PROTECTED]] Sent: Friday, April 27, 2001 6:23 AM To: [EMAIL PROTECTED] Subject: [PHP

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

2001-04-26 Thread Richard
Greetings.. This is how I currently check for instances of words and other: for ($i=0; $i < $total_lines; $i++){ $line_array = explode("|",$line[$i]); $swhat=strtolower($txtLinkname); $xos = array(strtolower($line_array[1]),strtolower($line_array[2]),strtolower($line _

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

[PHP] in_array() with multidimensional array

2001-03-09 Thread Christian Dechery
How can I check if a value is in a multidimensional array? like I have "; $produtos_sem_tracking[$i]['cod']=$idt[0]; $produtos_sem_tracking[$i]['idt']=$idt[1]; $produtos_sem_tracking[$i]['gen']=$idt[2]; } ?> how can I check for an existing