3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColorCLI { static $foreground_colors = array( 'bold' => '1', 'dim' => '2', 'black' => '0;30', 'dark_gray' => '1;30', 'blue' => '0;34', 'light_blue' => '1;34', 'green' => '0;32', 'light_green' => '1;32', 'cyan' => '0;36', 'light_cyan' => '1;36', 'red' => '0;31', 'light_red' => '1;31', 'purple' => '0;35', 'light_purple' => '1;35', 'brown' => '0;33', 'yellow' => '1;33', 'light_gray' => '0;37', 'white' => '1;37', 'normal' => '0;39', ); static $background_colors = array( 'black' => '40', 'red' => '41', 'green' => '42', 'yellow' => '43', 'blue' => '44', 'magenta' => '45', 'cyan' => '46', 'light_gray' => '47', ); static $options = array( 'underline' => '4', 'blink' => '5', 'reverse' => '7', 'hidden' => '8', ); public static function __callStatic( $foreground_color, $args ) { $string = $args[0]; $colored_string = ""; // Check if given foreground color found if( isset(self::$foreground_colors[$foreground_color]) ) { $colored_string .= "\033[" . self::$foreground_colors[$foreground_color] . "m"; }else{ die( $foreground_color . ' not a valid color'); } array_shift($args); foreach( $args as $option ){ // Check if given background color found if(isset(self::$background_colors[$option])) { $colored_string .= "\033[" . self::$background_colors[$option] . "m"; }elseif(isset(self::$options[$option])) { $colored_string .= "\033[" . self::$options[$option] . "m"; } } // Add string and end coloring $colored_string .= $string . "\033[0m"; return $colored_string; } public static function bell($count = 1) { echo str_repeat("\007", $count); } } echo ColorCLI::red("text");

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.40.0130.00318.83
8.3.30.0140.00319.22
8.3.20.0050.00320.34
8.3.10.0050.00320.53
8.3.00.0000.00819.25
8.2.170.0070.00722.96
8.2.160.0070.00720.34
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00422.23
8.2.110.0040.00420.17
8.2.100.0000.01218.04
8.2.90.0040.00419.22
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0040.00418.05
8.2.50.0080.00018.07
8.2.40.0030.00618.22
8.2.30.0040.00419.20
8.2.20.0060.00317.77
8.2.10.0030.00518.20
8.2.00.0080.00017.76
8.1.270.0000.00824.02
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0030.00623.80
8.1.230.0070.00419.16
8.1.220.0050.00317.74
8.1.210.0030.00518.77
8.1.200.0060.00617.35
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0090.00018.63
8.1.160.0000.00722.02
8.1.150.0000.00718.83
8.1.140.0040.00417.48
8.1.130.0070.00017.85
8.1.120.0080.00017.54
8.1.110.0000.00917.46
8.1.100.0040.00417.47
8.1.90.0040.00417.47
8.1.80.0000.00917.43
8.1.70.0020.00517.36
8.1.60.0060.00317.50
8.1.50.0000.00917.50
8.1.40.0030.00617.52
8.1.30.0000.00817.66
8.1.20.0030.00617.73
8.1.10.0040.00417.49
8.1.00.0040.00417.47
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0030.00318.51
8.0.270.0000.00717.18
8.0.260.0030.00317.15
8.0.250.0030.00317.02
8.0.240.0040.00416.89
8.0.230.0070.00016.90
8.0.220.0030.00316.93
8.0.210.0000.00716.95
8.0.200.0030.00616.84
8.0.190.0080.00016.98
8.0.180.0040.00416.99
8.0.170.0050.00216.90
8.0.160.0070.00016.92
8.0.150.0000.00716.89
8.0.140.0000.01016.93
8.0.130.0000.00513.41
8.0.120.0000.00816.92
8.0.110.0000.00716.93
8.0.100.0020.00516.70
8.0.90.0070.00016.73
8.0.80.0060.01016.81
8.0.70.0000.00716.79
8.0.60.0000.00716.93
8.0.50.0040.00416.98
8.0.30.0120.00717.14
8.0.20.0100.01617.40
8.0.10.0070.00016.95
8.0.00.0130.00516.68
7.4.330.0000.00515.07
7.4.320.0030.00316.45
7.4.300.0060.00016.61
7.4.290.0000.00716.52
7.4.280.0000.00916.41
7.4.270.0000.00716.59
7.4.260.0000.00716.43
7.4.250.0000.00816.50
7.4.240.0000.00716.66
7.4.230.0030.00316.64
7.4.220.0110.01416.48
7.4.210.0040.01116.56
7.4.200.0070.00016.63
7.4.160.0030.01316.50
7.4.150.0090.01117.40
7.4.140.0080.00817.86
7.4.130.0050.01416.63
7.4.120.0060.01116.48
7.4.110.0110.00716.43
7.4.100.0130.01016.49
7.4.90.0140.00316.62
7.4.80.0100.00619.37
7.4.70.0120.00616.39
7.4.60.0090.00916.65
7.4.50.0000.00816.50
7.4.40.0180.00316.71
7.4.30.0030.01316.64
7.4.10.0090.01215.09
7.4.00.0080.01014.86
7.3.330.0030.00313.35
7.3.320.0020.00213.21
7.3.310.0000.00716.43
7.3.300.0000.00716.28
7.3.290.0070.01416.34
7.3.280.0090.00716.31
7.3.270.0090.00917.40
7.3.260.0220.00316.45
7.3.250.0080.00916.48
7.3.240.0100.01016.71
7.3.230.0000.01816.50
7.3.210.0130.00316.42
7.3.200.0090.00819.39
7.3.190.0090.01216.41
7.3.180.0060.01016.36
7.3.170.0060.00916.33
7.3.160.0120.00616.46
7.3.130.0040.01115.16
7.3.120.0000.01815.08
7.3.110.0130.00714.62
7.3.100.0130.00314.77
7.3.90.0060.01214.76
7.3.80.0000.01514.86
7.3.70.0070.00714.68
7.3.60.0030.00714.94
7.3.50.0040.00814.56
7.3.40.0000.01514.75
7.3.30.0090.00914.64
7.3.20.0030.00716.70
7.3.10.0060.01216.69
7.3.00.0070.01016.58
7.2.330.0060.01216.84
7.2.320.0150.00616.80
7.2.310.0130.01016.57
7.2.300.0070.01016.60
7.2.290.0060.01216.84
7.2.260.0030.01515.14
7.2.250.0000.01414.98
7.2.240.0040.00815.08
7.2.230.0120.00415.21
7.2.220.0040.01115.32
7.2.210.0040.01215.26
7.2.200.0100.00315.21
7.2.190.0030.01514.98
7.2.180.0030.01014.98
7.2.170.0100.01014.89
7.2.160.0030.01014.95
7.2.150.0040.01117.15
7.2.140.0110.00716.95
7.2.130.0030.01316.93
7.2.120.0030.01316.99
7.2.110.0030.00617.01
7.2.100.0060.01016.94
7.2.90.0040.01117.04
7.2.80.0040.01116.93
7.2.70.0030.00816.87
7.2.60.0060.00917.17
7.2.50.0030.01217.09
7.2.40.0060.00616.97
7.2.30.0040.01217.08
7.2.20.0030.00616.59
7.2.10.0060.00616.92
7.2.00.0030.01118.29
7.1.330.0030.00915.54
7.1.320.0090.00015.55
7.1.310.0080.00815.92
7.1.300.0060.00315.88
7.1.290.0110.00415.89
7.1.280.0030.01015.71
7.1.270.0080.00415.89
7.1.260.0040.01115.66
7.1.250.0060.01015.89
7.1.240.0030.01015.94
7.1.230.0030.01015.87
7.1.220.0030.00715.87
7.1.210.0090.00615.93
7.1.200.0030.01015.77
7.1.190.0070.00415.73
7.1.180.0060.00915.60
7.1.170.0070.00415.67
7.1.160.0040.00415.91
7.1.150.0080.00815.93
7.1.140.0000.01415.77
7.1.130.0070.00715.77
7.1.120.0060.00915.52
7.1.110.0070.01015.80
7.1.100.0030.01117.07
7.1.90.0040.00815.87
7.1.80.0030.00915.89
7.1.70.0050.01016.62
7.1.60.0030.01817.57
7.1.50.0080.01016.49
7.1.40.0000.01415.68
7.1.30.0060.00315.71
7.1.20.0060.00615.88
7.1.10.0000.01615.77
7.1.00.0080.03819.03
7.0.330.0030.01215.24
7.0.320.0060.00315.52
7.0.310.0000.01115.63
7.0.300.0090.00315.56
7.0.290.0030.00715.22
7.0.280.0100.00615.55
7.0.270.0000.01015.32
7.0.260.0090.00915.27
7.0.250.0060.00615.37
7.0.240.0090.00615.35
7.0.230.0080.00615.47
7.0.220.0070.00715.60
7.0.210.0030.01315.50
7.0.200.0020.01016.21
7.0.190.0070.00315.50
7.0.180.0000.01015.52
7.0.170.0100.00315.52
7.0.160.0090.00315.36
7.0.150.0080.00615.39
7.0.140.0060.04018.81
7.0.130.0040.00815.17
7.0.120.0060.00615.21
7.0.110.0040.01115.37
7.0.100.0100.00315.18
7.0.90.0060.01015.48
7.0.80.0030.01015.43
7.0.70.0030.01115.54
7.0.60.0040.03617.80
7.0.50.0110.02816.70
7.0.40.0170.03516.73
7.0.30.0200.02816.88
7.0.20.0070.02516.80
7.0.10.0080.04516.83
7.0.00.0070.02416.85
5.6.400.0040.01114.66
5.6.390.0030.01014.10
5.6.380.0120.00014.13
5.6.370.0000.01114.60
5.6.360.0000.01814.66
5.6.350.0060.00614.33
5.6.340.0080.00314.77
5.6.330.0030.01314.81
5.6.320.0030.01314.53
5.6.310.0070.01014.53
5.6.300.0090.00914.38
5.6.290.0090.00914.45
5.6.280.0110.03317.69
5.6.270.0040.00714.46
5.6.260.0040.01114.43
5.6.250.0040.00714.46
5.6.240.0040.00714.30
5.6.230.0100.00014.64
5.6.220.0040.01214.48
5.6.210.0090.04017.38
5.6.200.0070.04016.38
5.6.190.0030.02717.34
5.6.180.0290.04017.26
5.6.170.0220.02717.40
5.6.160.0070.04717.33
5.6.150.0000.03616.33
5.6.140.0070.04016.46
5.6.130.0030.02716.35
5.6.120.0030.02517.76
5.6.110.0050.02417.79
5.6.100.0100.04417.87
5.6.90.0070.04417.83
5.6.80.0100.04017.35
5.6.70.0030.00914.46
5.6.60.0150.00014.33
5.6.50.0050.00814.45
5.6.40.0030.00614.30
5.6.30.0130.00314.20
5.6.20.0070.00314.67
5.6.10.0000.01114.27
5.6.00.0110.00414.30
5.5.380.0070.01014.27
5.5.370.0030.01014.40
5.5.360.0030.01014.43
5.5.350.0160.02117.49
5.5.340.0100.03316.13
5.5.330.0050.04817.63
5.5.320.0230.02017.25
5.5.310.0150.03017.31
5.5.300.0020.03316.03
5.5.290.0080.04316.41
5.5.280.0050.04017.79
5.5.270.0080.02717.55
5.5.260.0080.04117.56
5.5.250.0050.04717.47
5.5.240.0120.04217.29
5.5.230.0060.00614.41
5.5.220.0090.00314.03
5.5.210.0030.01214.41
5.5.200.0000.01314.61
5.5.190.0040.00414.08
5.5.180.0000.01314.41
5.5.170.0090.00614.48
5.5.160.0070.00714.24
5.5.150.0060.00614.56
5.5.140.0040.01114.36
5.5.130.0070.00713.98
5.5.120.0060.01213.96
5.5.110.0060.01314.26
5.5.100.0030.00614.29
5.5.90.0070.00314.13
5.5.80.0030.01214.27
5.5.70.0090.00014.48
5.5.60.0000.01114.35
5.5.50.0090.00614.36
5.5.40.0040.00414.04
5.5.30.0060.00614.20
5.5.20.0100.00714.23
5.5.10.0090.00614.14
5.5.00.0070.00314.26
5.4.450.0320.02315.90
5.4.440.0560.02815.92
5.4.430.0500.02815.90
5.4.420.0370.00215.88
5.4.410.0350.00215.90
5.4.400.0320.00515.68
5.4.390.0370.00315.61
5.4.380.0320.02715.53
5.4.370.0200.03015.49
5.4.360.0280.02715.51
5.4.350.0280.03015.52
5.4.340.0300.03615.47
5.4.330.0070.00712.22
5.4.320.0050.02312.37
5.4.310.0090.02312.37
5.4.300.0060.02212.37
5.4.290.0030.02912.37
5.4.280.0080.02012.32
5.4.270.0020.02512.31
5.4.260.0050.02912.31
5.4.250.0080.02712.31
5.4.240.0060.02512.31
5.4.230.0070.02312.31
5.4.220.0060.02112.31
5.4.210.0070.02212.31
5.4.200.0050.02312.31
5.4.190.0040.02212.31
5.4.180.0040.02212.31
5.4.170.0060.02012.31
5.4.160.0030.02512.31
5.4.150.0020.02312.31
5.4.140.0040.02612.15
5.4.130.0070.02012.15
5.4.120.0080.01812.13
5.4.110.0050.02112.12
5.4.100.0070.02012.12
5.4.90.0040.02712.12
5.4.80.0030.03212.12
5.4.70.0030.02512.12
5.4.60.0030.02512.12
5.4.50.0020.02512.12
5.4.40.0050.02212.12
5.4.30.0100.02112.11
5.4.20.0020.02512.11
5.4.10.0080.01912.12
5.4.00.0050.02211.86
5.3.290.0060.03912.80
5.3.280.0030.04012.71
5.3.270.0060.04112.73
5.3.260.0050.04012.72
5.3.250.0060.03812.72
5.3.240.0060.04112.72
5.3.230.0040.04012.70
5.3.220.0040.03912.68
5.3.210.0050.03912.68
5.3.200.0080.03912.68
5.3.190.0100.03912.67
5.3.180.0070.05212.68
5.3.170.0100.04412.67
5.3.160.0080.05012.68
5.3.150.0050.03812.68
5.3.140.0030.04012.66
5.3.130.0070.03812.66
5.3.120.0080.04812.66
5.3.110.0060.04312.66
5.3.100.0110.04612.13
5.3.90.0060.04012.11
5.3.80.0050.03712.10
5.3.70.0070.03612.10
5.3.60.0060.03712.09
5.3.50.0040.03812.04
5.3.40.0090.03312.03
5.3.30.0090.03211.99
5.3.20.0060.03611.77
5.3.10.0030.03711.74
5.3.00.0030.03711.73
5.2.170.0060.0289.23
5.2.160.0050.0299.23
5.2.150.0050.0299.24
5.2.140.0040.0309.23
5.2.130.0050.0389.19
5.2.120.0060.0319.20
5.2.110.0030.0439.20
5.2.100.0040.0299.20
5.2.90.0050.0359.19
5.2.80.0060.0289.19
5.2.70.0060.0289.19
5.2.60.0050.0299.14
5.2.50.0030.0309.11
5.2.40.0060.0279.09
5.2.30.0040.0299.07
5.2.20.0060.0329.05
5.2.10.0020.0308.95
5.2.00.0020.0338.82
5.1.60.0090.0268.11
5.1.50.0070.0318.11
5.1.40.0010.0288.08
5.1.30.0060.0298.43
5.1.20.0050.0278.45
5.1.10.0040.0258.18
5.1.00.0050.0268.19
5.0.50.0050.0216.67
5.0.40.0040.0186.53
5.0.30.0040.0306.34
5.0.20.0040.0276.30
5.0.10.0040.0196.29
5.0.00.0030.0316.28
4.4.90.0040.0214.78
4.4.80.0020.0164.76
4.4.70.0030.0154.76
4.4.60.0020.0164.76
4.4.50.0010.0174.77
4.4.40.0030.0244.71
4.4.30.0030.0154.75
4.4.20.0020.0164.85
4.4.10.0030.0154.85
4.4.00.0040.0234.76
4.3.110.0010.0174.67
4.3.100.0020.0154.66
4.3.90.0020.0154.64
4.3.80.0060.0214.58
4.3.70.0020.0154.63
4.3.60.0020.0154.63
4.3.50.0010.0174.63
4.3.40.0010.0254.54
4.3.30.0030.0203.30
4.3.20.0030.0203.28
4.3.10.0010.0163.24
4.3.00.0100.01314.30

preferences:
40.72 ms | 400 KiB | 5 Q