Connecting Tech Pros Worldwide Forums | Help | Site Map

array query

Francis S
Guest
 
Posts: n/a
#1: Apr 15 '07
$record= array(
"product"=>array(
array("name"=>"apple","price"=>30.5),
array("name"=>"orange","price"=>20)
)
);

echo array_read($record, "[product][0][price]") //out 30.5

print_r (array_read($record, "[product][*][name]")) //out
array("apple","orange")

echo array_read($record, "[product][*=>(name=orange)][price]") //out
20

echo array_read($record, "[product][(*)=>(price>20)][name]") //out
"apple"
echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
null
echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
20


http://pleiadesworks.blogspot.com/20...ad-arrays.html


Schraalhans Keukenmeester
Guest
 
Posts: n/a
#2: Apr 15 '07

re: array query


Francis S wrote:
Quote:
$record= array(
"product"=>array(
array("name"=>"apple","price"=>30.5),
array("name"=>"orange","price"=>20)
)
);
>
echo array_read($record, "[product][0][price]") //out 30.5
>
print_r (array_read($record, "[product][*][name]")) //out
array("apple","orange")
>
echo array_read($record, "[product][*=>(name=orange)][price]") //out
20
>
echo array_read($record, "[product][(*)=>(price>20)][name]") //out
"apple"
echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
null
echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
20
>
>
http://pleiadesworks.blogspot.com/20...ad-arrays.html
>
array_read() is not in my PHP manual. I don't really see the points you
are trying to make here or on your blog. You're surely not just spamming
for attention?

Sh.
Vince Morgan
Guest
 
Posts: n/a
#3: Apr 15 '07

re: array query


"Francis S" <francissem@gmail.comwrote in message
news:1176601726.643587.69890@p77g2000hsh.googlegro ups.com...
Quote:
$record= array(
"product"=>array(
array("name"=>"apple","price"=>30.5),
array("name"=>"orange","price"=>20)
)
);
>
echo array_read($record, "[product][0][price]") //out 30.5
>
print_r (array_read($record, "[product][*][name]")) //out
array("apple","orange")
>
echo array_read($record, "[product][*=>(name=orange)][price]") //out
20
>
echo array_read($record, "[product][(*)=>(price>20)][name]") //out
"apple"
echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
null
echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
20
>
>
>
http://pleiadesworks.blogspot.com/20...ad-arrays.html
Quote:
>
Is this one of those games where you offer the answer so someone can find
the question?


Francis S
Guest
 
Posts: n/a
#4: Apr 15 '07

re: array query


On Apr 15, 1:22 pm, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
Quote:
Francis S wrote:
Quote:
$record= array(
"product"=>array(
array("name"=>"apple","price"=>30.5),
array("name"=>"orange","price"=>20)
)
);
>
Quote:
echo array_read($record, "[product][0][price]") //out 30.5
>
Quote:
print_r (array_read($record, "[product][*][name]")) //out
array("apple","orange")
>
Quote:
echo array_read($record, "[product][*=>(name=orange)][price]") //out
20
>
Quote:
echo array_read($record, "[product][(*)=>(price>20)][name]") //out
"apple"
echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
null
echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
20
>>
array_read() is not in my PHP manual. I don't really see the points you
are trying to make here or on your blog. You're surely not just spamming
for attention?
>
Sh.
just an idea without using foreach.. . maybe someone can proposals a
better one

ZeldorBlat
Guest
 
Posts: n/a
#5: Apr 15 '07

re: array query


On Apr 15, 7:38 am, "Francis S" <francis...@gmail.comwrote:
Quote:
>
just an idea without using foreach.. . maybe someone can proposals a
better one
Yeah -- use DOM and XPath.

Jerry Stuckle
Guest
 
Posts: n/a
#6: Apr 15 '07

re: array query


Francis S wrote:
Quote:
$record= array(
"product"=>array(
array("name"=>"apple","price"=>30.5),
array("name"=>"orange","price"=>20)
)
);
>
echo array_read($record, "[product][0][price]") //out 30.5
>
print_r (array_read($record, "[product][*][name]")) //out
array("apple","orange")
>
echo array_read($record, "[product][*=>(name=orange)][price]") //out
20
>
echo array_read($record, "[product][(*)=>(price>20)][name]") //out
"apple"
echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
null
echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
20
>
>
http://pleiadesworks.blogspot.com/20...ad-arrays.html
>
Seems to be a solution to a non-existent problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Schraalhans Keukenmeester
Guest
 
Posts: n/a
#7: Apr 15 '07

re: array query


Francis S wrote:
Quote:
On Apr 15, 1:22 pm, Schraalhans Keukenmeester <bitbuc...@invalid.spam>
wrote:
Quote:
>Francis S wrote:
Quote:
>>$record= array(
>> "product"=>array(
>> array("name"=>"apple","price"=>30.5),
>> array("name"=>"orange","price"=>20)
>> )
>>);
>>echo array_read($record, "[product][0][price]") //out 30.5
>>print_r (array_read($record, "[product][*][name]")) //out
>>array("apple","orange")
>>echo array_read($record, "[product][*=>(name=orange)][price]") //out
>>20
>>echo array_read($record, "[product][(*)=>(price>20)][name]") //out
>>"apple"
>>echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
>>null
>>echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
>>20
>>http://pleiadesworks.blogspot.com/20...asier-way-to-r...
>array_read() is not in my PHP manual. I don't really see the points you
>are trying to make here or on your blog. You're surely not just spamming
>for attention?
>>
>Sh.
>
just an idea without using foreach.. . maybe someone can proposals a
better one
>
And what does array_read() look like in that case? To be honest I had
the same feeling Jerry had, I don't really see a realistic problem being
solved, but I kind'a hoped the magic would be in your array_read(). But
after rereading I still don't see an implementation.

But then I've been known to make a fool of myself more than once, so I'm
here with two leges ready for pulling. Surprise me!

Sh.
Steve
Guest
 
Posts: n/a
#8: Apr 16 '07

re: array query



"Vince Morgan" <vinhar@REMOVEoptusnet.com.auwrote in message
news:4621d472$0$16553$afc38c87@news.optusnet.com.a u...
| "Francis S" <francissem@gmail.comwrote in message
| news:1176601726.643587.69890@p77g2000hsh.googlegro ups.com...
| $record= array(
| "product"=>array(
| array("name"=>"apple","price"=>30.5),
| array("name"=>"orange","price"=>20)
| )
| );
| >
| echo array_read($record, "[product][0][price]") //out 30.5
| >
| print_r (array_read($record, "[product][*][name]")) //out
| array("apple","orange")
| >
| echo array_read($record, "[product][*=>(name=orange)][price]") //out
| 20
| >
| echo array_read($record, "[product][(*)=>(price>20)][name]") //out
| "apple"
| echo array_read($record, "[product][(0)=>(name=orange)][price]") //out
| null
| echo array_read($record, "[product][(1)=>(name=orange)][price]") //out
| 20
| >
| >
| >
|
http://pleiadesworks.blogspot.com/20...ad-arrays.html
| >
| Is this one of those games where you offer the answer so someone can find
| the question?

BINGO !!!

btw, you are the winner! you win via answer proximity...'WTF is the problem'
was what trebec was expecting, however 'wtf is the question' is close
enough.

:)


Closed Thread