In this experiment, I tested the execution time of the script Zend\bench.php available in the PHP socurce code. I tested the latest PHP versions available, as follows:
- PHP 7.1.32
- PHP 7.2.22
- PHP 7.3.9
- PHP 7.4RC1
| <?php | |
| // Simple HTTP static file server using Swoole | |
| $host = $argv[1] ?? '127.0.0.1'; | |
| $port = $argv[2] ?? 9501; | |
| $http = new swoole_http_server($host, $port); | |
| // The usage of enable_static_handler seems to produce errors | |
| // $http->set([ |
In this experiment, I tested the execution time of the script Zend\bench.php available in the PHP socurce code. I tested the latest PHP versions available, as follows:
| <?php | |
| // APIs for overriding functions and methods of classes | |
| override_class_function(string $class, string $method, Closure $callback); | |
| override_function(string $function, Closure $callback); | |
| call_orginal_function(array $params); | |
| // Example of usage override_function() | |
| override_function('curl_exec', function(){ | |
| $params = func_get_args(); | |
| echo "--- BEFORE ---"; |
I executed the Zend\bench.php file using PHP 7.4.7 and PHP 8 alpha2.
I used a CPU Intel i9-8950HK at 2.90GHz with 32GB RAM running Ubuntu 18.04.4 LTS.
I compiled PHP 8 alpha2 using the official php.net source and installed in /opt/php/php8. I used the following configure options:
./configure --prefix=/opt/php/php8 --enable-opcache --with-zlib --enable-zip --enable-json --enable-sockets --without-pear
I executed the Zend\bench.php file using PHP 7.4.10 and PHP 8 beta4.
I used a CPU Intel i9-8950HK at 2.90GHz with 32GB RAM running Ubuntu 18.04.4 LTS.
I compiled PHP 8 beta4 using the official php.net source and installed in /opt/php/php8. I used the following options:
./configure --prefix=/opt/php/php8 --enable-opcache --with-zlib --enable-zip --enable-json --enable-sockets --without-pear
| # Example of function call using OpenAI | |
| # by Enrico Zimuel (https://github.com/ezimuel) | |
| # | |
| # To run the code you need the OPENAI_API_KEY as env variable | |
| # For more information: https://platform.openai.com/docs/guides/function-calling?api-mode=chat | |
| from openai import OpenAI | |
| import requests | |
| import json | |
| import datetime |