Hi,
I am working on a C extension module for PHP and am wondering about an API
issue.
I can see how to add to an associative array :-
zval *aa;
MAKE_STD_ZVAL(aa);
array_init(aa);
Hi,
I am working on a C extension module for PHP and am wondering about an API
issue.
I can see how to add to an associative array :-
zval *aa;
MAKE_STD_ZVAL(aa);
array_init(aa);
add_assoc_string(aa, "test", "test value", 1);
add_assoc_string(aa, "test2", "test value2", 1);
but how do I transverse an associative array of values in a for loop simular
to using "foreach" in PHP ?
Hope this is not too OT for this list, but I could not find a better place
to ask the question.
I have looked through the API SVN sources and this seems like a possible
blind spot.
Many thanks in advance,
Aaron
but how do I transverse an associative array of values in a for loop simular
to using "foreach" in PHP ?
Hope this is not too OT for this list, but I could not find a better place
to ask the question.
I have looked through the API SVN sources and this seems like a possible
blind spot.
Many thanks in advance,
Aaron
Hello,
Hi,
I am working on a C extension module for PHP and am wondering about an API
issue.I can see how to add to an associative array :-
Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c
-Chris
"Chris Stockton" chrisstocktonaz@gmail.com wrote in message
news:CALKFbxvsUq-zQyYtdXi3a9tcciEH6xzZ9Y-kByqVa8kpC4-NiQ@mail.gmail.com...
Hello,
Hi,
I am working on a C extension module for PHP and am wondering about an
API
issue.I can see how to add to an associative array :-
Most everything you need to know about manipulating arrays can be
found in ext/standard/array.c
Where's that in the SVN source tree ?
Aaron
"Chris Stockton" chrisstocktonaz@gmail.com wrote in message news:CALKFbxvsUq-zQyYtdXi3a9tcciEH6xzZ9Y-kByqVa8kpC4-NiQ@mail.gmail.com...
Hello,
Hi,
I am working on a C extension module for PHP and am wondering about an API
issue.I can see how to add to an associative array :-
Most everything you need to know about manipulating arrays can be
found in ext/standard/array.cWhere's that in the SVN source tree ?
Aaron
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/standard/
Chris
--
Email: christopher.jones@oracle.com
Tel: +1 650 506 8630
Blog: http://blogs.oracle.com/opal/
"Christopher Jones" christopher.jones@oracle.com wrote in message
news:4E56E662.90804@oracle.com...
"Chris Stockton" chrisstocktonaz@gmail.com wrote in message
news:CALKFbxvsUq-zQyYtdXi3a9tcciEH6xzZ9Y-kByqVa8kpC4-NiQ@mail.gmail.com...Hello,
On Thu, Aug 25, 2011 at 2:57 PM, Aaron Gray ang.usenet@gmail.com
wrote:Hi,
I am working on a C extension module for PHP and am wondering about an
API
issue.I can see how to add to an associative array :-
Most everything you need to know about manipulating arrays can be
found in ext/standard/array.cWhere's that in the SVN source tree ?
Aaron
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/ext/standard/
Chris,
How much can I access as a PHP plugin dll or shared object ?
Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.
Many thanks,
Aaron
Hi!
Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.
For this, you will need to call zend_hash_find (or zend_symtable_find if
there's a possibility of keys like "0" that have to be treated as 0). If
you get SUCCESS, the key exists and you'll be getting zval **, then
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call
zend_is_true(*val) to get generic truth value (like if(), etc. do).
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
Hi Stas,
"Stas Malyshev" smalyshev@sugarcrm.com wrote in message
news:4E56F0D6.20608@sugarcrm.com...
Hi!
Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.For this, you will need to call zend_hash_find (or zend_symtable_find if
there's a possibility of keys like "0" that have to be treated as 0).
Okay, found it, "zend_hash.h", so that should be accessable to my module :)
If you get SUCCESS, the key exists and you'll be getting zval **, then
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call
zend_is_true(*val) to get generic truth value (like if(), etc. do).
Great.
That seems alot simpler.
Many thanks,
Aaron
hi
every api has lots of 'samples' ,that are the standard extensions in src/ext/*
:)
Thanks
Sent from my iPhone
在 2011-8-26,11:20,Aaron Gray ang.usenet@gmail.com 写道:
Hi Stas,
"Stas Malyshev" smalyshev@sugarcrm.com wrote in message news:4E56F0D6.20608@sugarcrm.com...
Hi!
Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.For this, you will need to call zend_hash_find (or zend_symtable_find if there's a possibility of keys like "0" that have to be treated as 0).
Okay, found it, "zend_hash.h", so that should be accessable to my module :)
If you get SUCCESS, the key exists and you'll be getting zval **, then either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call zend_is_true(*val) to get generic truth value (like if(), etc. do).
Great.
That seems alot simpler.
Many thanks,
Aaron
Thanks !
"Xinchen Hui" laruence@gmail.com wrote in message
news:7256329410255948429@unknownmsgid...
hi
every api has lots of 'samples' ,that are the standard extensions in
src/ext/*
:)
Thanks
Sent from my iPhone
在 2011-8-26,11:20,Aaron Gray ang.usenet@gmail.com 写道:
Hi Stas,
"Stas Malyshev" smalyshev@sugarcrm.com wrote in message
news:4E56F0D6.20608@sugarcrm.com...Hi!
Thinking about it what I really want to do is see if a key exists in an
array and get its type to see if it is BOOL and that it is TRUE.For this, you will need to call zend_hash_find (or zend_symtable_find if
there's a possibility of keys like "0" that have to be treated as 0).Okay, found it, "zend_hash.h", so that should be accessable to my module
:)If you get SUCCESS, the key exists and you'll be getting zval **, then
either check it's type and value with Z_TYPE_PP and Z_LVAL_PP or call
zend_is_true(*val) to get generic truth value (like if(), etc. do).Great.
That seems alot simpler.
Many thanks,
Aaron
""Aaron Gray"" ang.usenet@gmail.com wrote in message
news:A1.A0.22704.0D5E65E4@pb1.pair.com...
"Chris Stockton" chrisstocktonaz@gmail.com wrote in message
news:CALKFbxvsUq-zQyYtdXi3a9tcciEH6xzZ9Y-kByqVa8kpC4-NiQ@mail.gmail.com...Hello,
Hi,
I am working on a C extension module for PHP and am wondering about an
API
issue.I can see how to add to an associative array :-
Most everything you need to know about manipulating arrays can be
found in ext/standard/array.cWhere's that in the SVN source tree ?
Ah, got it many thanks,
Aaron