Hi everyone.
I´m facing a big trouble that a don understand why is it happenin.
I´ve got an array with 1046 elements in it like this.
Here is a part of a print_r of my array.
Array ( [0] = 0001-01 [1] = 0003-01 [2] = 0140-01 [3] = 0141-01 [4] =
0142-01 [5] = 0170-03 [6] = 0181-01 [7] =
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.
here
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.
here is my solution to my problem.
The following code* was
sorry all for the mistake in the code;
in this line 'array $input' should be string $input.
function word_wise(array $input, int $what) //returns an array
so it reads
function word_wise(string $input, int $what) //returns an array
this should be the only mistake. I added this stuff as an
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 need to
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 degraded
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
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
//print
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
//print $formula[$i]; not right
if($formula[$i] $i)
{$str[$i] = '';}
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
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][]=Japan;
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;
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;
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;
}
}
thanks,
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][]=England;
I need to search an array for a string, with a twist. E.g.:
$array = array(0 = 'this sky is blue', 1 = 'pencils are orange', 2 =
'I like green apples', 3 = 'strawberries are red');
$key = array_search('green', $array);
With the above code, nothing will be returned, but I would like it to
Hi there,
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.
How could I shift this array to start with 1, or make array-search start with 0?
The array comes
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 array
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:
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
[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
-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 while now,
but have come across a problem. My
-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: Jay Blanchard [mailto:[EMAIL PROTECTED]
Sent: Thursday
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 problem, but
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 next...
Is there such a thing as an array_search wildcard? Say I want to find anything
beginning with RE and having zero or more characters following it, how would I do that?
$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
$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/)
To
Hi I'm runing a PHP Version 4.0.4pl1 on Solaris 8 X86 on apache, and I'm
trying to search an array
while(list($findId) = mysql_fetch_row($resultNextLast)){
$NextLast[] = $findId;
}
$currArrayPos = array_search($ImgId, $NextLast);
and this code results this error:
Fatal error: Call to
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
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
?
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
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]
CODE:
for($l
thats why you do not have a key which is not found. Try to replace $findme
withthis: $findme = array('banana', 'cranberry', 'not in there');
Will return: Key () was found for value not in there
So there is a bug.. but well hidden :-(
Von: Kevin Stone [EMAIL PROTECTED]
An: PHP-general [EMAIL
Hi,
Can anybody explain why the output of this script is
not found
Found!
Here is the script...
$legalfields = array(reasonForRepair);
if (array_search(reasonForRepair, $legalfields) == TRUE) {
echo Found!br;
} else {
echo not foundbr;
}
$legalfields = array(foo, reasonForRepair);
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 at
is not the same type as FALSE)...
Greets,
Edward
- Original Message -
From: Roger Keays [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 26, 2002 10:29 AM
Subject: [PHP] array_search
Hi,
Can anybody explain why the output of this script is
not found
Found!
Here is the script
I'm trying to figure out how am I supposed to write this snippet
properly:
if (($index = array_search($search, array_keys($pages))) !== false) {
echo index: $index\n;
} else {
echo Not found\n;
}
When I search for something that I know exists, it returns the $index
just fine.
I'm trying to figure out how am I supposed to write this snippet
properly:
if (($index = array_search($search, array_keys($pages))) !== false) {
echo index: $index\n;
} else {
echo Not found\n;
}
When I search for something that I know exists, it returns the $index
just fine.
Hi
How to figure out of a value is found using array_search ?
eg:
$myarray = array(val1,val2,val3);
if(array_search(val2,$myarray))
{
print Value found;
}
the above will work, but...
if(array_search(val1,$myarray))
{
print Value found;
}
the above will not work as val1 is key 0, how
40 matches
Mail list logo