Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] Question on return_value [RSS Feed]

#1 Nov. 1, 2005 06:46:42

Bob S.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Question on return_value


Hi,



I have an internal function defined that returns an array zval:



zval *pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, count, 0
TSRMLS_DC);







When I call it like this, return_value is NULL in userland.

return_value = pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator,
count, 0 TSRMLS_CC);





But when I call it like this, it works as expected and an array is returned
to userland

array = pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, count, 0
TSRMLS_CC);

*return_value = *array;





I'm sure there is an obvious answer, but given my background (or lack
thereof) in C, I can't figure it out.

How does the temporary assignment change things inside the engine?



Bob

Offline

#2 Nov. 1, 2005 10:46:27

Marcus B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] Question on return_value


Hello Bob,

look at RETURN_ZVAL() again.

Tuesday, November 1, 2005, 7:47:45 AM, you wrote:

> Hi,

>

> I have an internal function defined that returns an array zval:

>

> zval *pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, count, 0
> TSRMLS_DC);

>

>

>

> When I call it like this, return_value is NULL in userland.

> return_value = pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator,
> count, 0 TSRMLS_CC);

>

>

> But when I call it like this, it works as expected and an array is returned
> to userland

> array = pow_zstring_internal_split(Z_STRVAL_P(ivalue), separator, count, 0
> TSRMLS_CC);

> *return_value = *array;

>

>

> I'm sure there is an obvious answer, but given my background (or lack
> thereof) in C, I can't figure it out.

> How does the temporary assignment change things inside the engine?

>

> Bob




Best regards,
Marcus

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

Offline

  • Root
  • » PHP
  • » [PHP-DEV] Question on return_value [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support