peachpiecompiler / peachpie

PeachPie - the PHP compiler and runtime for .NET and .NET Core
https://www.peachpie.io
Apache License 2.0
2.33k stars 202 forks source link

Async functions in PeachPie #984

Open ghost opened 2 years ago

ghost commented 2 years ago

I want to run PHP code through PeachPie asynchronously, i thought it would be possible to simply call a PHP class from C# code from an async function and that the subsequent call would run asynchronously but that doesn't seem to work. This feature would be a really nice addition, either by adding async functions directly into the PHP code somehow or allow C# async functions to run the php code asynchronously.

jakubmisek commented 2 years ago

PHP functions are compiled into regular non-async .NET methods; you can call them normally from async C# methods.

Since the underlying APIs for I/O operations are not async, compiling PHP code as async methods would not make any sense tho. We would have to make database API and echo operator async first so it would be reasonable to start compiling PHP functions as async methods.