The problem is that PHP is written in C, and when you create an extension, you have to use PHP's interfaces. So, that's gonna be a really hard work to make a Delphi-extension to PHP. =)
The solution for you would be to develop a simple DLL in Delphi and a PHP-extension wrapper for it which would only call functions from the DLL.
Something like this:
script.php -> PHP -> php_delphi_lib.dll -> delphi_lib.dll