FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » returning values from a 2d array
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: returning values from a 2d array [message #180638 is a reply to message #180635] Thu, 07 March 2013 17:02 Go to previous messageGo to previous message
M. Strobel is currently offline  M. Strobel
Messages: 386
Registered: December 2011
Karma:
Senior Member
Am 07.03.2013 17:31, schrieb richard:
> On Thu, 07 Mar 2013 11:26:18 -0500, Jerry Stuckle wrote:
>
>> On 3/7/2013 10:49 AM, richard wrote:
>>> I have been searching the web for an answer but can't really find what I
>>> want to know.
>>>
>>> How do I retrieve the values from an array once the random number has been
>>> generated?
>>> In BASIC, one would simply say: show$=top$(1960,1).
>>> In PHP though, it seems you have to go through a miriad of loops just to
>>> find out if the value exists.
>>>
>>> So how is this done properly?
>>>
>>
>> $top is a three dimensional array and would be indexed as
>> $top[$x][$y][$z]. For instance, "Theme From a Summer Place" would be
>> $top[1960][1][0] and "Composer: J. P. Richardson" would be
>> $top[1960][4][4].
>>
>> I think you're going about this the wrong way, but hey - it's your code.
>
> Not according to the PHP manual.
> I have seen the format I'm using online and have tested it.
> I tried using $a=$top[1960][anum] and the output was "Array".
>

Listen to what people are telling you, or stop asking. Of course $top[1960][$anum] is
an array, you assigned it yourself:

$top[1960][2]= array("He'll H....

You have 3 index levels.

/Str.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Need help with updating ereg_replace function -> to preg_replace
Next Topic: Bowling
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 10:14:43 GMT 2024

Total time taken to generate the page: 0.04068 seconds