Well, I guess that hacking the php source would work. :) However, I was
just thinking that you Could do something like this:
(Note - not tested! :)
while (list ($key, $value) = mysql_fetch_array ($result, MYSQL_ASSOC)) {
$data[] =& $data[$key] = $value;
}
--zak
----- Original Message -----
From: "Marc Boeren" <[EMAIL PROTECTED]>
To: "'Zak Greant'" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 12, 2001 2:25 AM
Subject: RE: [PHP-DEV] how-to get array[0] and array["name"] to actually
reference only 1 value?
>
> >not bound together in any way. You may be able to accomplish what you
> >desire by using references. (See the manual section on references for
more
> >information.
>
> > ie. $q->data[0]["id"] =& $q->data[0][0];
>
> After looking for references in the php-code, I found something that seems
> to work ok (zend_assign_to_variable_reference):
>
> zval *dummy, *value, **x_ptr, **y_ptr;
> MAKE_STD_ZVAL(value);
> ZVAL_LONG(value, 10);
> ALLOC_ZVAL(dummy);
> INIT_ZVAL(*dummy);
> zend_hash_update(return_value->value.obj.properties, "x", sizeof("x"),
> &value, sizeof(zval *), (void **) &x_ptr);
> zend_hash_update(return_value->value.obj.properties, "y", sizeof("y"),
> &dummy, sizeof(zval *), (void **) &y_ptr);
> zend_assign_to_variable_reference(NULL, y_ptr, x_ptr, NULL ELS_CC);
>
> This leads me to another question: how do I obtain the x_ptr (from the
> example) if the zend_hash_update was done elsewhere and no ptr was passed
> then???
>
> zend_hash_update(return_value->value.obj.properties, "x", sizeof("x"),
> &value, sizeof(zval *), NULL);
> [...]
> // How do I get the x_ptr ???
> zend_hash_update(return_value->value.obj.properties, "y", sizeof("y"),
> &dummy, sizeof(zval *), (void **) &y_ptr);
> zend_assign_to_variable_reference(NULL, y_ptr, x_ptr, NULL ELS_CC);
>
> Cheerio, Marc.
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]