3v4l.org

run code in 300+ PHP versions simultaneously
<?php function show_star_rating_review($rating): string { //global $post; //$rating = get_field('rating', $post); [$whole, $decimal] = explode('.', $rating); $css = <<<CSS <style> .awb-stars-rating-1 .awb-stars-rating-filled-icon{ margin-right:2px; color:#ffd041; } .awb-stars-rating-1 .awb-stars-rating-empty-icon, .awb-stars-rating-1 .awb-stars-rating-partial-icon-wrapper{ margin-right:2px; } .awb-stars-rating-1 .awb-stars-rating-partial-icon{ color:#ffd041; } .awb-stars-rating-1 .awb-stars-rating-icons-wrapper{ color:#dbdbdb; font-size:23px; } </style> CSS; $stars['whole'] = str_repeat("<i class=\"fa-star fas awb-stars-rating-filled-icon\"></i>\n ", $whole); if ($decimal) { $stars['piece'] = sprintf( "<i class=\"fa-star fas awb-stars-rating-partial-icon-wrapper\"> <i class=\"fa-star fas awb-stars-rating-partial-icon\" style=\"width:%d0%%;\"></i> </i>\n ", $decimal ); } $stars['empty'] = str_repeat("<i class=\"fa-star fas awb-stars-rating-empty-icon\"></i>\n ", 5 - ceil($rating)); return sprintf( '%s <div class="awb-stars-rating awb-stars-rating-1 awb-stars-rating-no-text" aria-label="Rating: %s out of 5"> <div class="awb-stars-rating-icons-wrapper"> %s </div> </div>', $css, $rating, implode($stars) ); } $ratings = ['1.0', '1.5', '2.0', '2.7', '3.0', '3.6', '4.0', '4.9', '5.0']; foreach ($ratings as $rating) { echo show_star_rating_review($rating); echo "\n---\n"; }

Abusive script

This script was stopped while abusing our resources

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.3.110.0030.00616.50
8.3.100.0060.00324.06
8.3.90.0040.00426.77
8.3.80.0030.00618.25
8.3.70.0220.00616.58
8.3.60.0130.00316.75
8.3.50.0090.00920.36
8.3.40.0070.01018.97
8.3.30.0110.00418.63
8.3.20.0050.00324.18
8.3.10.0040.00424.66
8.3.00.0070.00026.16
8.2.230.0060.00320.94
8.2.220.0090.00037.54
8.2.210.0030.01326.77
8.2.200.0090.00316.63
8.2.190.0040.01116.58
8.2.180.0030.01425.92
8.2.170.0090.00619.08
8.2.160.0100.00722.96
8.2.150.0080.00025.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00019.89
8.2.110.0070.00421.13
8.2.100.0040.00717.91
8.2.90.0080.00017.88
8.2.80.0000.00817.97
8.2.70.0030.00717.75
8.2.60.0050.00317.75
8.2.50.0030.00617.98
8.2.40.0050.00318.22
8.2.30.0000.00718.20
8.2.20.0070.00020.41
8.2.10.0000.00717.80
8.2.00.0040.00419.43
8.1.290.0060.00330.84
8.1.280.0060.01025.92
8.1.270.0030.00722.16
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0070.00320.78
8.1.230.0070.00521.04
8.1.220.0050.00317.78
8.1.210.0060.00318.77
8.1.200.0080.00717.47
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0080.00017.68
8.1.160.0050.00218.84
8.1.150.0060.00618.62
8.1.140.0040.00417.52
8.1.130.0000.00718.96
8.1.120.0040.00417.43
8.1.110.0040.00417.41
8.1.100.0000.00817.38
8.1.90.0020.00517.55
8.1.80.0040.00417.51
8.1.70.0040.00417.50
8.1.60.0030.00617.50
8.1.50.0030.00617.52
8.1.40.0050.00317.60
8.1.30.0030.00517.64
8.1.20.0230.00017.66
8.1.10.0250.00317.60
8.1.00.0210.00017.59
8.0.300.0040.00420.15
8.0.290.0030.00716.75
8.0.280.0000.00718.52
8.0.270.0050.00316.91
8.0.260.0030.00318.39
8.0.250.0040.00416.97
8.0.240.0040.00417.05
8.0.230.0000.00717.07
8.0.220.0000.00716.96
8.0.210.0000.00716.89
8.0.200.0040.00416.98
8.0.190.0070.00417.06
8.0.180.0000.00817.02
8.0.170.0000.00917.04
8.0.160.0040.00416.91
8.0.150.0170.00416.90
8.0.140.0170.00616.81
8.0.130.0160.00816.93
8.0.120.0190.00616.83
8.0.110.0170.00617.07
8.0.100.0260.00016.88
8.0.90.0210.00216.99
8.0.80.0140.01017.05
8.0.70.0130.01016.98
8.0.60.0190.00716.98
8.0.50.0150.00916.95
8.0.30.0240.00316.98
8.0.20.0200.00716.97
8.0.10.0170.00417.15
7.4.330.0050.00015.55
7.4.320.0000.00616.59
7.4.300.0030.00316.62
7.4.290.0070.00016.62
7.4.280.0040.00416.43
7.4.270.0210.00416.63
7.4.260.0180.00016.63
7.4.250.0100.00816.56
7.4.240.0250.00016.52
7.4.230.0210.00316.69
7.4.220.0190.00016.43
7.4.210.0110.00816.58
7.4.200.0100.00516.63
7.4.190.0160.00716.52
7.4.180.0130.00516.52
7.4.160.0090.00916.56
7.4.150.0130.00616.57
7.4.140.0160.00316.40
7.4.130.0190.00016.50
7.4.120.0150.00616.43
7.4.110.0140.00516.52
7.4.100.0150.00416.72
7.4.90.0130.00916.63
7.4.80.0090.01016.52
7.4.70.0090.00916.51
7.4.60.0180.00216.50
7.4.50.0150.00416.55
7.4.40.0170.00316.36
7.4.30.0160.00316.52
7.4.20.0160.00316.45
7.4.10.0140.00516.57
7.4.00.0160.00416.45

preferences:
92.64 ms | 403 KiB | 5 Q