|
Posted by J on 02/16/06 17:59
I have two questions.
I was reading through the code at
http://www-128.ibm.com/developerworks/opensource/library/os-php-flexobj/
I'm looking for the section in the manual which explains my questions.. I
couldn't find it.
First, as I understand it curly syntax automatically converts arguments to
strings...
$book is a class (representing a table) with an array of $field items. The
constructor makes 'title' one of the array keys.
In the following, curly syntax seems to do the opposite.
$book->{'title'} = "PHP Hacks";
Is this any different from $book->fields['title'] = "..." ? I didn't see
anything on this in the arrays section or the curly syntax section of the
manual.
//Second question...
function insert()
{
global $db;
$fields = $this->table."_id, ";
$fields .= join( ", ", array_keys( $this->fields ) );
$inspoints = array( "0" );
foreach( array_keys( $this->fields ) as $field )
$inspoints []= "?";
$inspt = join( ", ", $inspoints );
Is this question mark thing a standard feature of associated for loops?
Where in the manual is it? You can imagine that searching for a question
mark in a php manual would be pretty stupid - hence, I tried it.
Thanks!
-J
[Back to original message]
|