Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8574

Re: returning values from a 2d array

From "M. Strobel" <sorry_no_mail_here@nowhere.dee>
Newsgroups comp.lang.php
Subject Re: returning values from a 2d array
Date 2013-03-07 18:02 +0100
Message-ID <aprvgdF1j4iU1@mid.uni-berlin.de> (permalink)
References <ewh1yyqb5sh0$.1ff3g2zafy3ux$.dlg@40tude.net> <khaf0m$bs1$1@dont-email.me> <1ia4fx4xt4z60$.1wcv8sw6oujxf$.dlg@40tude.net>

Show all headers | View raw


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.

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

returning values from a 2d array richard <noreply@example.com> - 2013-03-07 10:49 -0500
  Re: returning values from a 2d array Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-07 11:26 -0500
    Re: returning values from a 2d array richard <noreply@example.com> - 2013-03-07 11:31 -0500
      Re: returning values from a 2d array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-07 17:50 +0100
      Re: returning values from a 2d array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-07 18:02 +0100
      Re: returning values from a 2d array Jerry Stuckle <jstucklex@attglobal.net> - 2013-03-07 14:41 -0500
  Re: returning values from a 2d array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2013-03-07 17:48 +0100
    Re: returning values from a 2d array richard <noreply@example.com> - 2013-03-07 12:04 -0500
  Re: returning values from a 2d array Alastair Black <abqab.nemo@example.net> - 2013-03-07 15:00 -0700

csiph-web