3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * * Find the relative file system path between two file system paths * * @param string $frompath Path to start from * @param string $topath Path we want to end up in * * @return string Path leading from $frompath to $topath */ function find_relative_path ( $frompath, $topath ) { $from = explode( DIRECTORY_SEPARATOR, $frompath ); // Folders/File $to = explode( DIRECTORY_SEPARATOR, $topath ); // Folders/File $relpath = ''; $i = 0; // Find how far the path is the same while ( isset($from[$i]) && isset($to[$i]) ) { if ( $from[$i] != $to[$i] ) break; $i++; } if ($i === 0) { return NULL; } $j = count( $from ) - 1; // Add '..' until the path is the same while ( $i <= $j ) { if ( !empty($from[$j]) ) $relpath .= '..'.DIRECTORY_SEPARATOR; $j--; } // Go to folder from where it starts differing while ( isset($to[$i]) ) { if ( !empty($to[$i]) ) $relpath .= $to[$i].DIRECTORY_SEPARATOR; $i++; } // Strip last separator return substr($relpath, 0, -1); } var_dump(find_relative_path('D:/test/pokus/', 'test/file.less'));

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.60.0060.00918.48
8.3.50.0150.00522.12
8.3.40.0040.01518.89
8.3.30.0090.00619.21
8.3.20.0070.00020.37
8.3.10.0040.00421.90
8.3.00.0080.00019.38
8.2.180.0120.00416.88
8.2.170.0070.01422.96
8.2.160.0100.00320.38
8.2.150.0120.00624.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00322.23
8.2.110.0060.01619.39
8.2.100.0000.01117.91
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0040.00417.50
8.2.60.0050.00317.92
8.2.50.0000.01218.07
8.2.40.0080.00019.88
8.2.30.0050.00318.01
8.2.20.0000.00717.86
8.2.10.0000.00718.00
8.2.00.0030.00517.63
8.1.280.0030.01225.92
8.1.270.0080.00423.99
8.1.260.0040.00426.35
8.1.250.0030.00628.09
8.1.240.0090.00317.48
8.1.230.0070.00317.95
8.1.220.0000.00817.76
8.1.210.0040.00418.77
8.1.200.0000.01017.10
8.1.190.0000.00817.23
8.1.180.0080.00018.10
8.1.170.0040.00418.52
8.1.160.0030.00522.07
8.1.150.0020.00518.83
8.1.140.0030.00617.46
8.1.130.0030.00317.73
8.1.120.0040.00417.47
8.1.110.0000.00817.37
8.1.100.0040.00317.46
8.1.90.0000.00817.46
8.1.80.0040.00417.48
8.1.70.0000.00717.41
8.1.60.0080.00017.58
8.1.50.0070.00317.42
8.1.40.0000.00817.45
8.1.30.0000.00817.53
8.1.20.0060.00317.57
8.1.10.0000.00717.53
8.1.00.0040.00417.51
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0000.00718.51
8.0.270.0030.00317.26
8.0.260.0030.00317.26
8.0.250.0030.00316.98
8.0.240.0050.00316.94
8.0.230.0030.00316.83
8.0.220.0070.00016.79
8.0.210.0000.00816.79
8.0.200.0060.00316.88
8.0.190.0060.00316.84
8.0.180.0070.00016.95
8.0.170.0050.00316.91
8.0.160.0030.00316.90
8.0.150.0000.00816.84
8.0.140.0060.00316.75
8.0.130.0050.00013.32
8.0.120.0040.00416.86
8.0.110.0000.00816.77
8.0.100.0000.00816.71
8.0.90.0050.00216.86
8.0.80.0100.00717.00
8.0.70.0000.00816.92
8.0.60.0050.00216.78
8.0.50.0000.00816.91
8.0.30.0190.00116.95
8.0.20.0130.00517.42
8.0.10.0050.00216.98
8.0.00.0120.00716.82
7.4.330.0000.00715.00
7.4.320.0060.00316.61
7.4.300.0030.00316.54
7.4.290.0030.00316.61
7.4.280.0000.00816.60
7.4.270.0000.00716.49
7.4.260.0030.00316.45
7.4.250.0070.00016.49
7.4.240.0010.00616.47
7.4.230.0030.00316.49
7.4.220.0140.00316.64
7.4.210.0030.01016.68
7.4.200.0000.00816.65
7.4.160.0090.00916.60
7.4.150.0090.01517.40
7.4.140.0160.00217.86
7.4.130.0130.00716.61
7.4.120.0100.00716.52
7.4.110.0030.01916.38
7.4.100.0100.00616.46
7.4.90.0140.00316.52
7.4.80.0160.00719.39
7.4.70.0100.00716.68
7.4.60.0100.00616.57
7.4.50.0040.00416.23
7.4.40.0110.00516.59
7.4.30.0060.01516.50
7.4.00.0050.01114.97
7.3.330.0030.00313.34
7.3.320.0030.00313.34
7.3.310.0000.00816.44
7.3.300.0000.00716.37
7.3.290.0110.00416.29
7.3.280.0040.01416.32
7.3.270.0140.00717.40
7.3.260.0070.01016.25
7.3.250.0080.00816.31
7.3.240.0090.01216.38
7.3.230.0100.01016.57
7.3.210.0160.00016.64
7.3.200.0060.01219.39
7.3.190.0070.01116.34
7.3.180.0060.01016.29
7.3.170.0060.01616.55
7.3.160.0070.01316.36
7.3.120.0090.00915.15
7.3.110.0070.01014.81
7.3.100.0070.01014.97
7.3.90.0110.00715.08
7.3.80.0090.00614.90
7.3.70.0030.00914.55
7.3.60.0000.00914.68
7.3.50.0080.00814.71
7.3.40.0090.00014.79
7.3.30.0030.00914.84
7.3.20.0040.00716.51
7.3.10.0050.00816.53
7.3.00.0050.01016.45
7.2.330.0130.01016.78
7.2.320.0060.01016.57
7.2.310.0110.00716.80
7.2.300.0140.00316.45
7.2.290.0130.01016.75
7.2.250.0060.00915.09
7.2.240.0030.01315.01
7.2.230.0070.00415.07
7.2.220.0070.00715.11
7.2.210.0030.00615.26
7.2.200.0000.01614.71
7.2.190.0040.00815.11
7.2.180.0110.00415.06
7.2.170.0040.00715.09
7.2.130.0050.00516.97
7.2.120.0070.00616.77
7.2.110.0030.01116.85
7.2.100.0130.00316.43
7.2.90.0100.00716.93
7.2.80.0000.01816.91
7.2.70.0060.00316.89
7.2.60.0130.00316.67
7.2.50.0110.00716.72
7.2.40.0080.00316.77
7.2.30.0160.00416.36
7.2.20.0030.00817.02
7.2.10.0030.01116.83
7.2.00.0050.00818.21
7.1.330.0110.00415.57
7.1.320.0040.01116.01
7.1.310.0000.00915.83
7.1.300.0030.01015.82
7.1.290.0060.00915.97
7.1.280.0090.00615.62
7.1.270.0150.00015.58
7.1.260.0060.00315.89
7.1.250.0030.01315.68
7.1.240.0170.00315.47
7.1.230.0030.01215.49
7.1.220.0070.01315.32
7.1.210.0030.01015.75
7.1.200.0080.00415.77
7.1.190.0070.00715.82
7.1.180.0060.00615.72
7.1.170.0110.00315.73
7.1.160.0050.00515.60
7.1.150.0040.01115.39
7.1.140.0040.00415.68
7.1.130.0060.00915.66
7.1.120.0000.01315.70
7.1.110.0060.01015.89
7.1.100.0430.00515.84
7.1.90.0070.00515.59
7.1.80.0070.00715.88
7.1.70.0100.00316.37
7.1.60.0100.01017.59
7.1.50.0130.00725.38
7.1.40.0060.00615.73
7.1.30.0150.00315.84
7.1.20.0100.00715.71
7.1.10.0160.00315.42
7.1.00.0050.04219.15
7.0.330.0070.01115.21
7.0.320.0030.00915.18
7.0.310.0100.00715.14
7.0.300.0090.00615.30
7.0.290.0100.00315.33
7.0.280.0100.00615.31
7.0.270.0040.01115.06
7.0.260.0050.00815.25
7.0.250.0100.00714.99
7.0.240.0070.00715.14
7.0.230.0030.00515.37
7.0.220.0000.01215.44
7.0.210.0030.00915.20
7.0.200.0020.01015.97
7.0.190.0090.00615.33
7.0.180.0070.00715.45
7.0.170.0040.01015.16
7.0.160.0080.00315.24
7.0.150.0040.01115.14
7.0.140.0020.03918.72
7.0.130.0070.00715.32
7.0.120.0030.01014.93
7.0.110.0110.00015.04
7.0.100.0080.00815.20
7.0.90.0070.00715.16
7.0.80.0080.00614.84
7.0.70.0150.00414.60
7.0.60.0120.04017.55
7.0.50.0050.04416.46
7.0.40.0060.04116.59
7.0.30.0380.03316.74
7.0.20.0190.02216.77
7.0.10.0090.03016.70
7.0.00.0050.04916.79
5.6.380.0040.01114.16
5.6.370.0090.00613.98
5.6.360.0020.00914.16
5.6.350.0040.01114.15
5.6.340.0050.00914.16
5.6.330.0120.00414.18
5.6.320.0040.01114.06
5.6.310.0070.00714.07
5.6.300.0000.01414.30
5.6.290.0060.00814.06
5.6.280.0080.03817.47
5.6.270.0140.00014.23
5.6.260.0050.00814.11
5.6.250.0030.01014.15
5.6.240.0120.00014.18
5.6.230.0110.00314.01
5.6.220.0060.00914.07
5.6.210.0180.03717.28
5.6.200.0070.04516.15
5.6.190.0090.02517.23
5.6.180.0170.02917.29
5.6.170.0120.04517.38
5.6.160.0070.04117.19
5.6.150.0020.02816.18
5.6.140.0100.02616.27
5.6.130.0050.04316.10
5.6.120.0060.02317.59
5.6.110.0020.05517.52
5.6.100.0140.04017.67
5.6.90.0100.04017.82
5.6.80.0100.02017.18
5.6.70.1680.02217.35
5.6.60.0070.00714.21
5.6.50.0040.01113.96
5.6.40.0110.00414.21
5.6.30.0090.00614.04
5.6.20.0100.01014.06
5.6.10.0040.01214.07
5.6.00.0110.00614.37
5.5.380.0070.00011.47
5.5.370.0060.00311.16
5.5.360.0050.00610.84
5.5.350.0020.04515.78
5.5.340.0110.03614.70
5.5.330.0090.04215.81
5.5.320.0150.02315.55
5.5.310.0200.03815.78
5.5.300.0030.04014.56
5.5.290.0050.02314.69
5.5.280.0050.03716.10
5.5.270.0030.02515.83
5.5.260.0060.02816.15
5.5.250.0050.03915.67
5.5.240.1240.02115.62
5.5.230.0030.00611.06
5.5.220.0040.00710.97
5.5.210.0040.00711.06
5.5.200.0040.00810.86
5.5.190.0100.00311.15
5.5.180.0000.01111.20
5.5.170.0030.00710.95
5.5.160.0000.00911.19
5.5.150.0070.00711.00
5.5.140.0070.00411.18
5.5.130.0000.01211.16
5.5.120.0110.00010.81
5.5.110.0060.00011.13
5.5.100.0060.00610.98
5.5.90.0060.00011.25
5.5.80.0030.00511.08
5.5.70.0070.00311.11
5.5.60.0000.01111.16
5.5.50.0040.00411.00
5.5.40.0040.00410.65
5.5.30.0060.00610.66
5.5.20.0030.00710.88
5.5.10.0070.00011.20
5.5.00.0000.01010.82
5.4.450.0150.01915.09
5.4.440.0130.02115.06
5.4.430.0150.01915.21
5.4.420.0330.00615.21
5.4.410.0330.00315.04
5.4.400.0330.00215.04
5.4.390.0380.00314.90
5.4.380.0320.00315.06
5.4.370.0440.00014.93
5.4.360.0370.00614.96
5.4.350.0330.00514.99
5.4.340.0060.02311.38
5.4.330.0090.00310.97
5.4.320.0060.02011.79
5.4.310.0020.02711.68
5.4.300.0100.01811.61
5.4.290.0090.01811.75
5.4.280.0090.01911.78
5.4.270.0030.02411.63
5.4.260.0040.02311.55
5.4.250.0060.02611.77
5.4.240.0080.01811.67
5.4.230.0070.02211.64
5.4.220.0080.02011.67
5.4.210.0070.01911.71
5.4.200.0080.02111.64
5.4.190.0060.02011.49
5.4.180.0050.02211.56
5.4.170.0050.02011.74
5.4.160.0060.02311.71
5.4.150.0040.02311.55
5.4.140.0050.02711.66
5.4.130.0050.01911.40
5.4.120.0070.02011.62
5.4.110.0040.01911.32
5.4.100.0060.02011.63
5.4.90.0060.02111.46
5.4.80.0080.01711.35
5.4.70.0040.02211.46
5.4.60.0040.02111.60
5.4.50.0040.02311.41
5.4.40.0090.01911.50
5.4.30.0080.01711.58
5.4.20.0070.02311.39
5.4.10.0060.01911.43
5.4.00.0050.02011.23
5.3.290.0100.02011.75
5.3.280.0070.01811.65
5.3.270.0050.02311.69
5.3.260.0040.02311.53
5.3.250.0060.02211.65
5.3.240.0050.02211.48
5.3.230.0060.02011.64
5.3.220.0050.02311.43
5.3.210.0030.02411.60
5.3.200.0070.02111.57
5.3.190.0050.02111.62
5.3.180.0040.02111.59
5.3.170.0020.02111.65
5.3.160.0090.01911.65
5.3.150.0080.02011.67
5.3.140.0040.02111.65
5.3.130.0040.02311.56
5.3.120.0080.02211.57
5.3.110.0070.02411.64
5.3.100.0060.02011.30
5.3.90.0060.02311.39
5.3.80.0040.02111.29
5.3.70.0040.02311.21
5.3.60.0050.02011.39
5.3.50.0060.02011.30
5.3.40.0050.02011.26
5.3.30.0020.02311.29
5.3.20.0040.02511.02
5.3.10.0030.02110.99
5.3.00.0070.02011.09
5.2.170.0040.0229.46
5.2.160.0040.0189.41
5.2.150.0020.0219.42
5.2.140.0060.0159.26
5.2.130.0040.0169.36
5.2.120.0060.0159.36
5.2.110.0040.0189.37
5.2.100.0070.0159.36
5.2.90.0050.0159.20
5.2.80.0030.0179.33
5.2.70.0060.0259.16
5.2.60.0050.0159.12
5.2.50.0040.0219.13
5.2.40.0070.0139.32
5.2.30.0020.0179.25
5.2.20.0060.0179.22
5.2.10.0040.0169.11
5.2.00.0020.0208.90
5.1.60.0060.0138.39
5.1.50.0070.0128.39
5.1.40.0020.0178.38
5.1.30.0070.0128.62
5.1.20.0040.0178.57
5.1.10.0040.0178.44
5.1.00.0050.0138.43
5.0.50.0040.0127.67
5.0.40.0050.0097.60
5.0.30.0020.0197.51
5.0.20.0050.0097.49
5.0.10.0030.0117.48
5.0.00.0030.0167.48
4.4.90.0040.0076.73
4.4.80.0010.0126.72
4.4.70.0020.0106.72
4.4.60.0030.0106.72
4.4.50.0010.0106.73
4.4.40.0050.0136.70
4.4.30.0030.0096.72
4.4.20.0010.0106.77
4.4.10.0020.0096.77
4.4.00.0040.0136.72
4.3.110.0040.0096.68
4.3.100.0040.0136.67
4.3.90.0050.0076.66
4.3.80.0020.0156.63
4.3.70.0020.0106.66
4.3.60.0030.0096.66
4.3.50.0040.0096.66
4.3.40.0040.0136.61
4.3.30.0030.0086.01
4.3.20.0010.0116.00
4.3.10.0020.0135.98
4.3.00.0020.00810.95

preferences:
50.52 ms | 400 KiB | 5 Q