The simple types are returned using the following convenience macros:

As you can see, returning a value from a function involves setting the special return_value zval to the return value and then just returning from the function call. At the C level, all functions return void.

Simple sum() function:

Here we uppercase every other character of a string.