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.
>
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 afterthou
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
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
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] = '';
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;
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
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
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
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
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 option
> $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
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?
> 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
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
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]
>
>
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
AIL PROTECTED]>
Sent: Thursday, April 25, 2002 12:16 PM
Subject: [PHP] array_search
> 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 ()
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" <[E
nd 0 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
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
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!";
} else {
echo "not found";
}
$legalfields = array("foo", "reasonForRepa
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 fi
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 fi
I have a 2D array wherein each row is an associative array (which has keys that are
column names of
a certain MySQL table)
the array name is "sess_arrayPhotos".
I need to match PhotoId (2nd dimension key) for every row (numeric index) of the 2D
array.
I tried--
$keyPos=array_search($searchedfor
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
42 matches
Mail list logo