For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > January 2006 > cvs: phpdoc /en/internals/zendapi calling-user-functions.xml /en/internals/zendapi/f









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: phpdoc /en/internals/zendapi calling-user-functions.xml /en/internals/zendapi/f
Nuno Lopes

2006-01-22, 7:04 pm

nlopess Sun Jan 22 23:31:08 2006 UTC

Removed files:
/phpdoc/en/internals/zendapi/figures zend.10-userland.png

Modified files:
/phpdoc/en/internals/zendapi calling-user-functions.xml
Log:
replace another picture by text

http://cvs.php.net/viewcvs.cgi/phpd...2&diff_format=u
Index: phpdoc/en/internals/zendapi/calling-user-functions.xml
diff -u phpdoc/en/internals/zendapi/calling-user-functions.xml:1.1 phpdoc/en/internals/zendapi/calling-user-functions.xml:1.2
--- phpdoc/en/internals/zendapi/calling-user-functions.xml:1.1 Sun Aug 21 16:27:06 2005
+++ phpdoc/en/internals/zendapi/calling-user-functions.xml Sun Jan 22 23:31:08 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <!-- $Revision: 1.1 $ -->
+ <!-- $Revision: 1.2 $ -->
<sect1 id="zend.calling-user-functions">
<title>Calling User Functions</title>
<para>
@@ -72,54 +72,62 @@
<example id='example.call-user-func'>
<title>Calling user functions.</title>
<programlisting>
+<![CDATA[
zval **function_name;
zval *retval;

-if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &function_name) != SUCCESS))
+if((ZEND_NUM_ARGS() != 1) || (zend_get_parameters_ex(1, &function_name) != SUCCESS))
{
WRONG_PARAM_COUNT;
}

-if((*function_name)-&gt;type != IS_STRING)
+if((*function_name)->type != IS_STRING)
{
zend_error(E_ERROR, "Function requires string argument");
}

TSRMSLS_FETCH();

- if(call_user_function_ex(CG(function_tab
le), NULL, *function_name, &retval, 0, NULL, 0) != SUCCESS)
+if(call_user_function_ex(CG(function_ta
ble), NULL, *function_name, &retval, 0, NULL, 0) != SUCCESS)
{
zend_error(E_ERROR, "Function call failed");
}

-zend_printf("We have %i as type&lt;br&gt;", retval-&gt;type);
+zend_printf("We have %i as type\n", retval->type);

*return_value = *retval;
zval_copy_ctor(return_value);
-zval_ptr_dtor(&retval);
+zval_ptr_dtor(&retval);
+]]>
</programlisting>
</example>
<para/>
- <programlisting>
-&lt;?php
+ <programlisting>
+<![CDATA[
+<?php

dl("call_userland.so");

function test_function()
{
-
- print("We are in the test function!&lt;br&gt;");
-
- return("hello");
-
+ echo "We are in the test function!\n";
+ return 'hello';
}

$return_value = call_userland("test_function");

-print("Return value: \"$return_value\"&lt;br&gt;");
-?&gt;
- </programlisting>
- <graphic fileref="figures/zend.10-userland.png"/>
+echo "Return value: '$return_value'";
+?>
+ ]]>
+ </programlisting>
+ &example.outputs;
+ <para>
+<![CDATA[
+We are in the test function!
+We have 3 as type
+Return value: 'hello'
+]]>
+ </para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com