That's the way!


Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com



> -----Original Message-----
> From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 03, 2002 8:26 PM
> To: 'Scott Fletcher'; [EMAIL PROTECTED]
> Subject: RE: [PHP] Re: Any ideas on combining arrays????
> 
> Use a multi-dimensional array... try this as a kind of 'proof of
> concept'
> 
> <?php
> 
> $array["tu4r"][]=0
> $array["tu4r"][]=10
> $array["tu4r"][]=100
> $array["tu4r"][]=1000
> $array["ph10"][]=0;
> $array["ph10"][]=1;
> $array["ph10"][]=2;
> $array["ph10"][]=126;
> 
> echo '<pre>';
> foreach ( $array["ph10"] as $value ) {
>       echo '  PH10: '.$value.chr(10);
> }
> echo '</pre>';
> echo '<pre>';
> foreach ( $array["tu4r"] as $value ) {
>       echo '  TU4R: '.$value.chr(10);
> }
> echo '</pre>';
> 
> ?>
> 
> cheers
> -----Original Message-----
> From: Scott Fletcher [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 03, 2002 10:15 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: Any ideas on combining arrays????
> 
>     Well, I don't thinik this will work.  Because I will recieve an
> unknown
> number of data.  The number of PH10 I would get would be either 1 or 2
> or
> 126, etc.  There is no way to determine the number, so I already
create
> an
> counter to tell me how many of them.  So, that leave me with an need
to
> create an array to unlimited number of PH10 without overwritting the
> current
> PH10.  Here's my demo.
> 
>     TU4R = "TU4R is 0"
>     PH10 = "PH10 is 0"
>     PH10 = "PH10 is 1"
>     PH10 = "PH10 is 2"
> 
>     Can anyone write a multidimentional array demostration to handle
> this
> demo?
> 
> Thanks a Million!
>  Scott
> 
> "Maxim Maletsky" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > See, Scott.. It is all about your logic.
> >
> > For instance, you can create a nice multidimentional array like
this:
> >
> > Array(
> > '0'=>Array(
> > 'data'=>Array(     // your whole data array
> > ....  data
> > ....  data
> > ....  data
> > ),
> > 'parameters'=>Array(     // the settings rlative to data array
> > 'count'=>'256',
> > 'type_of_data'=>'strings',
> > 'came_from_DB'=>'PostgreSQL',
> > 'came_from_table'=>'thisTable'
> > 'etc'=>'bla...bla..bla..'
> > )
> > ),
> > '1'=>Array(
> > 'data'=>Array(     // your whole data array
> > ....  data
> > ....  data
> > ....  data
> > ),
> > 'parameters'=>Array(     // the settings rlative to data array
> > 'count'=>'258',
> > 'type_of_data'=>'integers',
> > 'came_from_DB'=>'mySQL',
> > 'came_from_table'=>'thatTable'
> > 'etc'=>'bla...bla..bla..'
> > )
> > ),
> >
> > ... etc....etc...etc...
> >
> > );
> >
> >
> >
> > in this way you can loop the whole thing, access the data by
refering
> to
> the
> > 'data' subarray and then get the parameters (counts, types whatever
> you
> > want) by accessing 'parameters' subarray containing the relative
> settings
> > for that very array.
> >
> > As I said in the very first line - all up to your logic and the
> organization
> > rules within the code.
> >
> > Hope it is of any help to you.
> >
> >
> > Maxim Maletsky
> >
> > Founder, Chief Developer
> > PHPBeginner.com (Where PHP Begins)
> >
> > www.PHPBeginner.com
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> >
> > Scott Fletcher writes:
> >
> > > Hi!
> > >
> > >     Need some ideas on combining some arrays into one!  I have
array
> for
> > > data and other array for counter.  How do I make an array that
would
> show
> > > different data for each counter number?
> > >
> > > -- clip --
> > >    $FFR = array (
> > >       "TU4R"      => array( "data" => "", "count" => "" ),
> > >       "PH01"      => array( "data" => "", "count" => "" ),
> > >    );
> > > -- clip --
> > >
> > >     The response should look something like this when I pick the
> correct
> > > data and correct count;
> > >
> > >    $FFR["TU4R"]["data"]["0"]["count"]  = "TU4R is 0";
> > >    $FFR["TU4R"]["data"]["1"]["count"] = "TU4R is 1";
> > >    $FFR["TU4R"]["data"]["2"]["count"]  = "TU4R is 2";
> > >
> > >     I tried to do something like this but it doesn't work.  I have
> been
> > > working for 2 days trying to figure it out.  I appreciate any help
> you
> can
> > > provide for me.
> > >
> > > Thanks,
> > >   Scott
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
> >
> > Maxim Maletsky
> >
> > Founder, Chief Developer
> > PHPBeginner.com (Where PHP Begins)
> >
> > www.PHPBeginner.com
> > [EMAIL PROTECTED]
> >
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to