replace another picture by text

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@205758 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Nuno Lopes 2006-01-22 23:31:08 +00:00
parent 76f3533d91
commit ad941769f8
2 changed files with 25 additions and 17 deletions

View file

@ -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 @@ int no_separation);
<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, &amp;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_table), NULL, *function_name, &amp;retval, 0, NULL, 0) != SUCCESS)
if(call_user_function_ex(CG(function_table), 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(&amp;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:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB