3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CI_Controller { public function __construct() { } public function post($wl) { $data = []; foreach (array_keys($wl) as $f) { $data[$f] = $_POST[$f] ?? null; } return $data; } } class Search extends CI_Controller { public object $SearchModel; public function __construct() { parent::__construct(); $this->SearchModel = new Search_model(); $whitelist = get_object_vars($this->SearchModel); // var_export($whitelist); foreach ($this->post($whitelist) as $prop => $val) { $this->SearchModel->$prop = $val; } } public function test() { $this->SearchModel->searchByCategory(); } } class CI_Model { public function __construct() { } } class Search_model extends CI_Model { public ?int $productId = null; public ?string $productName = null; public ?string $category = null; public ?string $datetime = null; public ?int $userId = null; public function __construct() { parent::__construct(); //$this->load->database(); } public function searchByCategory() { var_dump(get_object_vars($this)); /* return $this->db->get_where('products', ['category' => $this->category])->result(); */ } } $_POST = ['productId' => '8', 'category' => 'foo']; (new Search())->test();

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.30.0350.00616.44
8.5.20.0380.00716.45
8.5.10.0310.00916.71
8.5.00.0300.01016.59
8.4.180.0330.00819.69
8.4.170.0320.00819.77
8.4.160.0340.01119.44
8.4.150.0310.01219.71
8.4.140.0360.00717.36
8.4.130.0350.00917.69
8.4.120.0310.01217.70
8.4.110.0360.01017.75
8.4.100.0430.00517.61
8.4.90.0460.00617.52
8.4.80.0320.01417.57
8.4.70.0400.00517.88
8.4.60.0360.00717.67
8.4.50.0290.01017.70
8.4.40.0390.01017.73
8.4.30.0380.00517.58
8.4.20.0190.00417.91
8.4.10.0160.00617.80
8.3.300.0230.00818.47
8.3.290.0410.00818.44
8.3.280.0300.00518.63
8.3.270.0290.00716.69
8.3.260.0320.00816.73
8.3.250.0310.00616.67
8.3.240.0270.01116.64
8.3.230.0340.00716.87
8.3.220.0360.00516.37
8.3.210.0320.00516.73
8.3.200.0320.00816.84
8.3.190.0320.00516.63
8.3.180.0410.00416.46
8.3.170.0390.00816.58
8.3.160.0380.00816.48
8.3.150.0330.00816.65
8.3.140.0160.00516.64
8.3.130.0340.00716.71
8.3.120.0220.00216.62
8.3.110.0190.00716.89
8.3.100.0170.00316.86
8.3.90.0250.00416.79
8.3.80.0260.00716.61
8.3.70.0390.00716.77
8.3.60.0320.00816.75
8.3.50.0330.01016.66
8.3.40.0400.00618.10
8.3.30.0280.01217.75
8.3.20.0320.00417.94
8.3.10.0280.00818.04
8.3.00.0220.01017.94

preferences:
48 ms | 723 KiB | 5 Q