One thing I see is if $needle is in the array, but $array[$key]!=$needle, your function will still return something (try seek($array, '1', 'tre'); ). Is this desired behaviour? If not, the following would seem a simpler method:
Thanks a lot for the ready replay.
I've to use that function for a tiny Blog
(tiny but I think cool it can run with data both
retrieve from a Db and Xml file (you can choice)
using a Abstract class)
with a caching system.
Because of that I'd like to retrieve
the select article not by select * from mytable where id=1
or
$query= "/items/{$this->item}[id/text()={$id}]";
$items= $this->xp->query($query);
Yet thanks a lot for the suggestion ;)
I use it only into admin side
but by the function I've posted
I'm developing an arrayiterator class.
From cache file I retrieve an array like
this for instance:
array(7) {
[0]=>
array(5) {
["id"]=>
string(1) "1"
["title"]=>
string(38) "The Dutch accessibility law is awesome"
["author"]=>
string(5) "Yasin"
["article"]=>
string(448) "Despite having been in effect since September 1 2006, I had not seen any mention of the Dutch law that regulates the quality of government websites until Peter-Paul Koch mentioned it in his post New Dutch accessibility law.
Despite having been in effect since September 1 2006, I had not seen any mention of the Dutch law that regulates the quality of government websites until Peter-Paul Koch mentioned it in his post New Dutch accessibility law."
["posted"]=>
string(10) "1171700539"
}
[1]=>
array(5) {
["id"]=>
string(1) "2"
["title"]=>
string(43) "Designing with Web Standards, 2nd Edition ("
["author"]=>
string(7) "Whisher"
["article"]=>
string(682) "I think almost every Web professional who uses Web standards knows who Jeffrey Zeldman is. If you happen to be one of the few who don’t, he is one of the pioneers of the Web standards movement. Without him and the work he has done, most of us would still be using tables within tables within tables and spacer GIFs to create websites.
I think almost every Web professional who uses Web standards knows who Jeffrey Zeldman is. If you happen to be one of the few who don’t, he is one of the pioneers of the Web standards movement. Without him and the work he has done, most of us would still be using tables within tables within tables and spacer GIFs to create websites."
["posted"]=>
string(10) "1171700579"
}
What do you think about ?
Bye and take care 😉