Search code examples
phpcphp-extension

PHP: How to call echo in custom module / extension


I am getting through following beginner tutorial about writing custom extesions in C for PHP. This tutorial module hello.so defines a function hello_world that can be echoed from php.

But how can i call echo directly from C code of the module?


Solution

  • The function you're looking for is php_printf. It uses classic printf syntax. This quick introduction to some of the concepts might prove useful for you.