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.
>
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
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
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
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
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
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
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";
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][]
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
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;
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/
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
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
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
> -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
> -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
[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
> $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
$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
> 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
> 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
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]
>
>
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
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
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
26 matches
Mail list logo