Dear List -
Here is a code snippet:
$bla = array("g1" => $results[7][6],
"h1" => $results[7][7]);
print_r($bla);
$value = "h1";
$locate1 = array_search($value, $bla);
echo "This is locate" ; print_r($locate1);
if(in_array($value, $bla)) print_r($b
direction.
Alice
> From: rene7...@gmail.com
> Date: Thu, 11 Mar 2010 07:12:15 +0100
> Subject: Re: [PHP] Array Search Problem
> To: aj...@alumni.iu.edu
> CC: php-general@lists.php.net
>
> (almost) all the tricks are in the comments of the help page for a
> function, on php.ne
(almost) all the tricks are in the comments of the help page for a
function, on php.net
but all functions accept only a given (and usually documented) set of
parameter(type)s, so you'll probably have to prepare the var, or even
call the function in a loop, outputting to yet another descriptively
n
>
> did you read the help for those functions on php.net?
Yes, I found a "recursive" way to find out the "index" like I wanted, by doing
something like
$from = explode("-", $from);
$state_colors= explode("-", $state_colors);
$change = explode("-",$change);
$count = count($new_array);
$i=0;
f
did you read the help for those functions on php.net?
On Wed, Mar 10, 2010 at 4:12 PM, Alice Wei wrote:
>
> Hi,
>
> I have the code as shown in the following that I am trying to create the
> image of based on the file loaded into the file and additional edits. The
> problem here appears to be
Hi,
I have two arrays here that I have combined into a new array, as shown here:
$from = explode("-", $from);
$change = explode("-",$change);
$new_array = array_combine($from,$change);
I then tried reading it from a file and do string matches, trying to find out
the "key" using the array_sea
Hi,
I have the code as shown in the following that I am trying to create the
image of based on the file loaded into the file and additional edits. The
problem here appears to be that no matter what value I have in the
$distance_to_destination variable, it does not affect any changes on the
probably missing something but php have a function called array_search.
Ben
On Sun, 23 Jan 2005 11:33:16 -0500 (EST), [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> > I've been trying for days now to make this work.
>
> This worked for me (with my IP address for 'John'):
>
> $viz_ip= $
Thank you Sirs,
I was echoing the viz-ip so I know it was getting set but
I couldn't get it.
both work .. I got the clue from John, the last echo line did the
trick.
On Sun, 23 Jan 2005 17:26:58 +0100, Jochem Maas <[EMAIL PROTECTED]>
wrote:
Malcolm wrote:
Hello All,
I've been tryin
> I've been trying for days now to make this work.
This worked for me (with my IP address for 'John'):
"Mark",
"63.230.76.166"=>"Bob",
"84.196.101.86"=>"John",
);
function _array_search ($viz_ip, $byte_ip) {
foreach($byte_ip as $key => $val) {
if ($viz_ip === $key) {
Malcolm wrote:
Hello All,
I've been trying for days now to make this work.
I'm trying to search my array for a value and return the key.
I get the visitor's IP and try this -- this is the latest,
I've tried a few functions to echo the name associated with the viz_ip.
$viz_ip= $_SERVER['REMOTE_A
Hello All,
I've been trying for days now to make this work.
I'm trying to search my array for a value and return the key.
I get the visitor's IP and try this -- this is the latest,
I've tried a few functions to echo the name associated with the viz_ip.
$viz_ip= $_SERVER['REMOTE_ADDR'];
$byte_ip
Oops! Sorry I got a reply for this but didn't read my mail carefully
enough. Thanks to Tim Ward for pointing out the problem.
> I've a 2 D array and would like to search for vals. in the first dimension
> only i.e.
> myArray[0][0]
> myArray[1][0]
> myArray[2][0]
> myArray[3][0]
> .
> .
> .
> and n
I've a 2 D array and would like to search for vals. in the first dimension
only i.e.
myArray[0][0]
myArray[1][0]
myArray[2][0]
myArray[3][0]
.
.
.
and not in the elements myArray[0][1]
CODE:
for($l = 0; $l < count($layer); $l++) {
$key = array_search($layer[$l], $layerDes); // $layerDes
btw, you may want to search for a name surrounded by spaces as philip vs
philips, jim vs jimmy, etc. probably other considerations as well, or
maybe not :)
philip
On Fri, 31 Aug 2001, Philip Olson wrote:
> try this :
>
> $people = array ('philip','sasheen','jim');
> $string = 'Hi, my n
try this :
$people = array ('philip','sasheen','jim');
$string = 'Hi, my name is philip, I miss Sasheen';
foreach ($people as $person) {
if (stristr($string,$person)) {
$matches[] = $person;
}
}
// results live in $matches now.
print_r($matches);
stristr is case
On Vie 31 Ago 2001 17:49, you wrote:
> What about going the other way? Say I have a sentence...
>
> "Hi, my name is Bob."
>
> ...and I want to search the sentence for one of the values (people) in the
> array...
>
> $people = array("Jim","John","JP","Bob");
>
> Can this be done?
Yes, split the se
What about going the other way? Say I have a sentence...
"Hi, my name is Bob."
...and I want to search the sentence for one of the values (people) in the
array...
$people = array("Jim","John","JP","Bob");
Can this be done?
Thanks,
Joseph
-Original Message-
yes, in_array($person,
hat uses a btree or
some other type of search methodology.
Johan
-Original Message-
From: Papp Gyozo [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 10:02 AM
To: Joseph Bannon; PHP (E-mail)
Subject: Re: [PHP] array search
yes, in_array($person, $people)!
however, you may t
quot;Irix", "Linux");
> if (in_array ("Irix", $os)){
> print "Got Irix";
> }
>
> Andrey HristovIcyGEN Corporationhttp://www.icygen.comBALANCED SOLUTIONS
> - Original Message -
> From: "Joseph Bannon" <[EMAIL PROTECTED]>
>
yes, in_array($person, $people)!
however, you may take a look into the manual.
- Original Message -
From: Joseph Bannon <[EMAIL PROTECTED]>
To: PHP (E-mail) <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 5:40 PM
Subject: [PHP] array search
> I have an array of na
-
From: "Joseph Bannon" <[EMAIL PROTECTED]>
To: "PHP (E-mail)" <[EMAIL PROTECTED]>
Sent: Friday, August 31, 2001 6:40 PM
Subject: [PHP] array search
> I have an array of names, like below...
>
> $people = array("Jim","John",&quo
I have an array of names, like below...
$people = array("Jim","John","JP");
Is there a way in an IF statement to see if someone's name is in the array?
Like...
if ($people =~ $person) { }
I don't want to have to create a foreach loop to go through the array to see
if that person is there.
Jos
23 matches
Mail list logo