On Tue, 20 Mar 2001, Barry Mitchelson wrote:

> ok, I have managed to add a member variable, but am having problems when i try to 
>retreive it using zend_find_hash
> 
> here's the code :
> 
> for the extension :
> 
> PHP_FUNCTION(create_object)
> {
> 
>       ... other stuff
> 
>       add_property_string(return_value,"foo","hello!",1);
> 
>       ... other stuff
> }
> 
> PHP_FUNCTION(my_other_function)
> {
>       zval **tmpString;
>       zval *obj;
> 
>       obj = getThis();
>       
>       
>zend_hash_find(obj->value.obj.properties,"foo",sizeof("foo"),(void**)&tmpString);
> 
>       convert_to_string_ex(tmpString);
> 
>       zend_printf("foo = %s",tmpString);
> }
>

Z_STRVAL_PP(tmpString)

in the zend_printf() statement.
 
> that doesn't work :(
> 
> but in a php script it does :
> 
> <?
>       $myObject = create_object();
>       
>       echo $myObject->foo;
> 
> ?>
> 
> produces "hello!"
> 
> what am i doing wrong ?!
> 
> barry
> 
> On Mon, Mar 19, 2001 at 07:01:44PM -0500, Sterling Hughes wrote:
> > On Mon, 19 Mar 2001, Barry Mitchelson wrote:
> > 
> > > hey,
> > > 
> > > I'm writing an extension which defines a class.  In the constructor, I'd like to 
>create a member variable which I can then access with the other member functions in 
>my extension.
> > > 
> > > In php it would be like :
> > > 
> > > class foo
> > > {
> > > 
> > >   var $m_bar;
> > > 
> > >   function foo()
> > >   {
> > >           $this->m_bar = 123;
> > >   }
> > > 
> > >   function a()
> > >   {
> > >           return $this->m_bar;
> > >   }
> > > 
> > > }
> > >
> > 
> > look at adding it to the value.obj.properties of the class (its a
> > HashTable).
> > 
> > -Sterling
> > 
> > 
> > -- 
> > 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]
> 
> 


-- 
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]

Reply via email to