Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Richard Lynch
Ben Edwards wrote: > From the manual > > "For each key/value pair it will create a variable in the current symbol > table". > > What exactly is a simble table? Internally, PHP stores variables in an array. That array is sometimes referred to as a "symbol table" because each symbol (variable name)

Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Jason Barnett
Ben Edwards wrote: ... What exactly is a simble table? Ben The symbol table is the where, deep down inside the guts of the Zend Engine, your variables are stored. There are symbol tables for different scopes (function, class, global) -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/s

Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Richard Lynch
Ben Edwards (lists) wrote: > I have the following code;_ > > $sql = "select * from text where id= '$id' "; > > $row = fetch_row_row( $sql, $db ); You may also wish to consider: list($img_loc, $text_type, $seq, $rec_type, $section, $code, $repeat, $description, $text) = fetch_row_r

Re: [PHP] Creating a varable with a name held in a string

2005-02-11 Thread Ben Edwards
On Thu, 10 Feb 2005 23:08:22 -0500, John Holmes <[EMAIL PROTECTED]> wrote: > Randy Johnson wrote: > > I like to do this: > > > > foreach( $row as $key=>$val) { > > > > $$key = $row[$key]; > > > > } > > You're just recreating a slower version of extract()... extract seems like the ticket, but as

Re: [PHP] Creating a varable with a name held in a string

2005-02-10 Thread John Holmes
Randy Johnson wrote: I like to do this: foreach( $row as $key=>$val) { $$key = $row[$key]; } You're just recreating a slower version of extract()... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phpar

Re: [PHP] Creating a varable with a name held in a string

2005-02-10 Thread Randy Johnson
I will read over extract and change my ways ;-) Randy John Holmes wrote: Randy Johnson wrote: I like to do this: foreach( $row as $key=>$val) { $$key = $row[$key]; } You're just recreating a slower version of extract()... -- PHP General Mailing List (http://www.php.net/) To unsubscribe,

Re: [PHP] Creating a varable with a name held in a string

2005-02-10 Thread Randy Johnson
I like to do this: foreach( $row as $key=>$val) { $$key = $row[$key]; } John Holmes wrote: Ben Edwards (lists) wrote: I have the following code;_ $sql = "select * from text where id= '$id' "; $row = fetch_row_row( $sql, $db ); $img_loc= $

Re: [PHP] Creating a varable with a name held in a string

2005-02-10 Thread John Holmes
Ben Edwards (lists) wrote: I have the following code;_ $sql = "select * from text where id= '$id' "; $row = fetch_row_row( $sql, $db ); $img_loc= $row["img_loc"]; $text_type = $row["text_type

Re: [PHP] Creating a varable with a name held in a string

2005-02-10 Thread Richard Davey
Hello Ben, Friday, February 11, 2005, 12:36:16 AM, you wrote: BEl> So the question is is there a function like create_var which BEl> takes a string and a value and creates a variable? $var_name = "new_variable"; $$var_name = "hello world"; echo $new_variable; Search for "variable variables" in

[PHP] Creating a varable with a name held in a string

2005-02-10 Thread Ben Edwards (lists)
I have the following code;_ $sql = "select * from text where id= '$id' "; $row = fetch_row_row( $sql, $db ); $img_loc= $row["img_loc"]; $text_type = $row["text_type"]; $seq