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 do
-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($name, self
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?
FALSE -- in_array checks the
-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-
If I have an array that looks like
array(1) {
[mac_address]=
string(2
-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-
If I have an array that looks like
array(1) {
[mac_address
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 McConnell
--
On 25 June 2010 19:58, Bob McConnell r...@cbord.com 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
From: Peter Lind
On 25 June 2010 19:58, Bob McConnell r...@cbord.com 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
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)
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 and found an
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
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
?php
$node_review_types = array(
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)
$
$ cat
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 in_array2.php
?php
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
?php
$node_review_types = array(
'page' = 'page',
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
?php
$node_review_types = array(
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
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
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=39356edit=2. This happens after my
upgrade to PHP 5.2, where the code shown produces a Fatal
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 understanding
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
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('/( )+/',
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 and don't want to set the variable if the in_array is
true..
the code works, up until i add the last
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
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 to
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
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
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
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
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
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.
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 compare the
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
$_SESSION[bkmks] is a
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 think
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:
form name=img1 method=post action=upload_done.php
enctype=multipart/form-data
input type=file
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 an
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 does it do a
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;
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
: [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 Osborne [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 3:08 PM
To: PHP-General (E-mail
ROTECTED]
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 Osborne [mailto:[EMAIL P
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?
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
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,
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
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
the 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
How can I check if a value is in a multidimensional array?
like I have
?php
$i=0;
while($idt = mssql_fetch_row($query_result))
{
//echo $idt[0]."br";
$produtos_sem_tracking[$i]['cod']=$idt[0];
$produtos_sem_tracking[$i]['idt']=$idt[1];
recusrion is your friend.
?php
$test[0][0] = 'a';
$test[0][1] = 'b';
$test[0][2] = 'c';
$test[1][0] = 'd';
$test[1][1] = 'e';
$test[1][2] = 'f';
$test[2][0] = 'g';
$test[2][1] = 'h';
$test[2][2] = 'i';
function in_multi_array($needle, $haystack)
{
foreach($haystack as $pos = $val)
49 matches
Mail list logo