I agree with Markus. PHP isn't C (although it resembles on some points), and
likewise you shouldn't use it, as you would C.

Play PHP by its own rules and use the language contructs made available to
you.

You could argue, that C only has structs because a) it is strongly typed and
therefore need a tool for complex datatypes and/or b) it doesn't implement
hashes in its core.

- Carsten


> -----Oprindelig meddelelse-----
> Fra: Markus Fischer [mailto:[EMAIL PROTECTED]]
> Sendt: 2. september 2002 15:16
> Til: Terrence Cox
> Cc: [EMAIL PROTECTED]
> Emne: Re: [PHP-DEV] Structures and PHP
>
>
> On Mon, Sep 02, 2002 at 10:06:50PM +0800, Terrence Cox wrote :
> > Knowing that I can't create actual structures in PHP, I
> recently realized I could do something like this.
> >
> > <?php
> > function create_Struct($struct_array)
> >    {
> >    $struct_array=array(
> >      conn => 0,
> >      host => "",
> >      u_name => "",
> >      pass => "",
> >      db => ""
> >      );
> >     return $struct_array;
> >     }
> >
> > $db_struct = create_Struct($db_struct);
> > $db_pointer = &$db_struct;
> > print_r($db_pointer);
> > ?>
> >
> > What I'm curious about is the possibility of making
> > something like this "built in", for lack of a better term. I've
> heard a number of C guys asking about this on some message boards
> and came up with this as a result.
> >
> > Is there a better way? What do you guys think?
>
>     Not really. Some also missuse objects for that purpose. heck,
>     I remember asking this question first when I came to PHP
>     years ago :) I got stuck to use arrays at first. Later and
>     never needed this anymore (stopped coding PHP like C) and
>     mainly used real objects etc.
>
> --
> GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
> "Finally, if someone actually flying a plane is relying on
> a freakin' webcam to land, we're all in trouble."
> - A /. poster.
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to