Re: [PHP] array_search function bugged? update

2006-03-27 Thread Robin Vickery
On 27/03/06, je killen <[EMAIL PROTECTED]> wrote: > Hi all > Here is an update on my problem reported with the array_search function. > to those who directed me to the bug report page, thanks. > There are a number of reports specific to this function. Maybe event > someone else has written a fix. >

Re: [PHP] array_search function bugged?

2006-03-21 Thread Jim Lucas
Richard Lynch wrote: On Mon, March 20, 2006 8:35 pm, je killen wrote: I really don't understand, though, why you are doing things the way you describe... I only want one image file for each distinct letter, no repeats because I can't put two or more files with the same name in the sa

Re: [PHP] array_search function bugged?

2006-03-21 Thread Richard Lynch
On Mon, March 20, 2006 8:47 pm, je killen wrote: > I am using simple for loops. If I create and populate an array and > test > it with a print statement > in a for loop, it prints out all the current values. It I again call > it > to print in a for loop in subsequent code > it has exhibited a degra

Re: [PHP] array_search function bugged?

2006-03-21 Thread Richard Lynch
On Mon, March 20, 2006 8:35 pm, je killen wrote: >> I really don't understand, though, why you are doing things the way >> you describe... > I only want one image file for each distinct letter, no repeats > because > I can't put two or more files with the same name > in the same dir. The images ne

Re: [PHP] array_search function bugged?

2006-03-20 Thread Richard Lynch
On Sun, March 19, 2006 4:46 pm, je killen wrote: > The following code does not produce the correct results (for my > purposes): > > function code($str, $match, $formula) > { > for($i = 0; $i < count($str); $i++) > { > $formula[$i] = array_search($str[$i], $str);// <<==|| no bueno >//pri

Re: [PHP] array_search function bugged?

2006-03-19 Thread Richard Davey
On 19 Mar 2006, at 22:46, je killen wrote: The code takes a string of ascii letters forming a word and is supposed to create a list of indexes in the proper sequence for reconstructing the word. The object of the code in context is to take Ignoring your code (and the supposed 'bug') for a s

Re: [PHP] array_search and multi-dimensional arrays

2006-03-14 Thread List Manager
M. Sokolewicz wrote: List Manager wrote: jonathan wrote: I'd like to return the first key value in the following array such that England would return 1 rather than 3 which is the second key value. Any help would be greatly appreciated. $c[1][]="Vietnam"; $c[1][]="China"; $c[1][]="Thailand

Re: [PHP] array_search and multi-dimensional arrays

2006-03-14 Thread M. Sokolewicz
List Manager wrote: jonathan wrote: I'd like to return the first key value in the following array such that England would return 1 rather than 3 which is the second key value. Any help would be greatly appreciated. $c[1][]="Vietnam"; $c[1][]="China"; $c[1][]="Thailand"; $c[1][]="England";

Re: [PHP] array_search and multi-dimensional arrays

2006-03-14 Thread List Manager
jonathan wrote: I'd like to return the first key value in the following array such that England would return 1 rather than 3 which is the second key value. Any help would be greatly appreciated. $c[1][]="Vietnam"; $c[1][]="China"; $c[1][]="Thailand"; $c[1][]="England"; $c[2][]="USA"; $c[2][]

Re: [PHP] array_search and multi-dimensional arrays

2006-03-13 Thread Philip Thompson
On Mar 13, 2006, at 5:54 PM, jonathan wrote: I'd like to return the first key value in the following array such that England would return 1 rather than 3 which is the second key value. Any help would be greatly appreciated. $c[1][]="Vietnam"; $c[1][]="China"; $c[1][]="Thailand"; $c[1][]="En

Re: [PHP] array_search and multi-dimensional arrays

2006-03-13 Thread jonathan
looks like this works. Is there any problem with it that people can see? $c[1][]="Vietnam"; $c[1][]="China"; $c[1][]="Thailand"; $c[1][]="England"; $c[2][]="USA"; $c[2][]="Japan"; print_r($c); foreach($c as $key=>$value) { if(array_search("England",$value)) { echo $key;

Re: [PHP] array_search does not find the first element

2004-03-31 Thread John Holmes
Merlin wrote: I am trying to find values inside an array. This array always starts with 0. unfortunatelly array_search start searching with the array element 1. So the first element is always overlooked. Please read the text inside the big "Warning" box on the following page: http://us2.php.net/

Re: [PHP] array_search does not find the first element

2004-03-31 Thread Tom Rogers
Hi, Wednesday, March 31, 2004, 10:20:06 PM, you wrote: M> Hi there, M> I am trying to find values inside an array. This array always starts with 0. M> unfortunatelly array_search start searching with the array element 1. M> So the first element is always overlooked. M> How could I "shift" this a

Re: [PHP] array_search

2003-11-20 Thread CPT John W. Holmes
From: "Jake McHenry" <[EMAIL PROTECTED]> > I've been using array_search in my scripts for a while now, but have > come across a problem. My new page has a textarea field. If I enter > any new lines in the textarea, array_search returns false. [snip] > Kinda stuck here.. Not sure what I should try

RE: [PHP] array_search

2003-11-20 Thread Kelly Hallman
On Thu, 20 Nov 2003, Jay Blanchard wrote: > $foo = $_POST['textarea']; > $newFoo = str_replace("\n", " ", $foo); > $arrayFoo = explode(" ", $newFoo); In the code above any spaces on the lines will also be delimiters... I missed that part of the requirement...? Maybe I'm not understanding the prob

RE: [PHP] array_search

2003-11-20 Thread Jake McHenry
> -Original Message- > From: Jake McHenry [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 2:51 PM > To: 'Jay Blanchard' > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP] array_search > > > > -Original Message- > > From: Ja

RE: [PHP] array_search

2003-11-20 Thread Jake McHenry
> -Original Message- > From: Jay Blanchard [mailto:[EMAIL PROTECTED] > Sent: Thursday, November 20, 2003 2:48 PM > To: Jake McHenry; [EMAIL PROTECTED] > Subject: RE: [PHP] array_search > > > [snip] > I've been using array_search in my scripts for a whil

RE: [PHP] array_search

2003-11-20 Thread Jay Blanchard
[snip] I've been using array_search in my scripts for a while now, but have come across a problem. My new page has a textarea field. If I enter any new lines in the textarea, array_search returns false. I have tried using html_encode, addslashes, serialize and nothing yet has worked. My only other

Re: [PHP] Array_search wildcard

2003-03-21 Thread Liam Gibbs
> $found=array(); > foreach($array as $key => $value) { > if(ereg('RE.+',$value)) { // optionaly use eregi for case > insensitiveness >$found[$key]=$value; > } > } Thanks, Marek. With some minor adjustments, this worked out fine! -- PHP General Mailing List (http://www.php.net

Re: [PHP] Array_search wildcard

2003-03-21 Thread Marek Kilimajer
$found=array(); foreach($array as $key => $value) { if(ereg('RE.+',$value)) { // optionaly use eregi for case insensitiveness $found[$key]=$value; } } Liam Gibbs wrote: Is there such a thing as an array_search wildcard? Say I want to find anything beginning with RE and having zero o

Re: [PHP] array_search() problem

2002-09-12 Thread Bas Jobsen
> What I was looking for was finding out what was the index of thet > value, lets say I have a array with some values like (23, 56, 45, 47) > and i don't know where the walue I'm looking for is indexed in the array > and I want to find out what the indexnumber is, how would that be > possable $v

Re: [PHP] array_search() problem

2002-09-12 Thread Bas Jobsen
> Hi I'm runing a PHP Version 4.0.4pl1 on Solaris 8 X86 on apache, and I'm > trying to search an array >From the manual: array_search (PHP 4 >= 4.0.5) send earlier to this list: Re: [PHP] Array - Match From: Bas Jobsen <[EMAIL PROTECTED]> To: "N. Pari Purna Chand" <[EMAIL PROTECTED]>, <[EMAIL

Re: [PHP] array_search in 2-d arrays

2002-05-14 Thread Pushkar Pradhan
Regarding my recent post, I am sorry $key is not undefined it is just "0" or "FALSE". > 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] > >

Re: [PHP] array_search

2002-04-25 Thread Kevin Stone
Which brings us back to my original argument that the function isn't being used properly. I was just wrong about how it was being used improperly. array_search() returns NULL when there is no match. $result = array_search($findme[$i], $fruit); if (!is_null($result)) { print "Key ($result) wa

Re: [PHP] array_search

2002-02-26 Thread Edward van Bilderbeek - Bean IT
array_search returns the key-value of the searched value that is found... in the first case... the returned key is 0 because it's the first element... however... 0 is also the same as FALSE... you should use === (three ='s) ... it's used to compare both value and type... (and 0 is not the sam

Re: [PHP] array_search

2002-02-26 Thread Lars Torben Wilson
On Tue, 2002-02-26 at 01:29, Roger Keays wrote: > Hi, > > Can anybody explain why the output of this script is > > not found > Found! Yup. array_search() returns the key of the found object, as noted in the docs (http://www.php.net/array_search). Since the first test has the searched-for field