r/PHPhelp • u/Tefkal1on • Jul 29 '25
php_context
https://github.com/Pashgunt/php_context
I present my implementation of Context implemented as an extension for php in C, if you think it might be useful or have any suggestions, please rate
5
Upvotes
View all comments
Show parent comment
2
u/Big_Tadpole7174 Jul 30 '25
I believe you're right. I cooked something up quick that basically does the same, but in PHP.
Still, there might be benefits doing this as an extension. 1) The extension can use system-level timers and signals to track timeouts independently of PHP's execution thread. Pure PHP would need to rely on checking timestamps. 2) Checking
$ctx->isCancelled()in a tight loop is probably faster when implemented in C.