3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = "12345"; $time_start = microtime(true); echo $var[0] . "-" . substr($var,1); $time_end = microtime(true); echo "\nExecution Time: " . $time_end - $time_start; $time_start = microtime(true); echo str_replace($var[0], $var[0].'-', $var); $time_end = microtime(true); echo "\nExecution Time: " . $time_end - $time_start;
Output for 7.4.0
Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/rog1n on line 7 Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /in/rog1n on line 12 1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00021-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0003
Output for 7.2.19 - 7.2.20, 7.2.22, 7.3.3, 7.3.6, 7.3.8, 7.3.11 - 7.3.12
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00021-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0003
Output for 7.1.29, 7.2.17, 7.2.23 - 7.2.25, 7.3.7, 7.3.10
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00021-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0002
Output for 7.3.9
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00031-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0004
Output for 7.1.26 - 7.1.28, 7.1.30, 7.1.32 - 7.1.33, 7.2.18, 7.2.21, 7.3.0 - 7.3.1, 7.3.4 - 7.3.5
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00011-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0002
Output for 7.1.31, 7.3.2
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00011-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0001
Output for 7.2.0
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00371-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0037
Output for 7.1.7
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00251-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0026
Output for 7.1.6
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00681-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0068
Output for 7.1.5
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00971-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0098
Output for 7.1.0
1-2345 Warning: A non-numeric value encountered in /in/rog1n on line 7 -1404049773.00411-2345 Warning: A non-numeric value encountered in /in/rog1n on line 12 -1404049773.0041
Output for 7.0.20
1-2345-1404049773.00591-2345-1404049773.006
Output for 7.0.14
1-2345-1404049773.00381-2345-1404049773.0038
Output for 5.4.22, 5.5.1, 5.6.8, 5.6.23, 7.0.8
1-2345-1364228587.00311-2345-1364228587.0031
Output for 7.0.5, 7.0.7
1-2345-1364228587.00331-2345-1364228587.0033
Output for 5.4.28, 7.0.6
1-2345-1364228587.00321-2345-1364228587.0032
Output for 5.5.2, 5.6.17, 7.0.4
1-2345-1364228587.00351-2345-1364228587.0035
Output for 7.0.3
1-2345-1364228587.00261-2345-1364228587.0026
Output for 5.4.15, 5.4.18, 5.4.26, 5.4.40, 5.5.18, 5.6.10, 7.0.2
1-2345-1364228587.00391-2345-1364228587.0039
Output for 5.6.4, 7.0.1
1-2345-1364228587.00421-2345-1364228587.0043
Output for 5.6.6, 7.0.0
1-2345-1364228587.00371-2345-1364228587.0038
Output for 5.6.28
1-2345-1404049773.00461-2345-1404049773.0046
Output for 5.5.14, 5.6.9, 5.6.11, 5.6.22
1-2345-1364228587.00451-2345-1364228587.0045
Output for 5.4.23, 5.5.22, 5.6.21
1-2345-1364228587.00431-2345-1364228587.0044
Output for 5.5.13, 5.6.20
1-2345-1364228587.00481-2345-1364228587.0049
Output for 5.4.21, 5.5.11, 5.6.18 - 5.6.19
1-2345-1364228587.00431-2345-1364228587.0043
Output for 5.5.5, 5.6.16
1-2345-1364228587.00491-2345-1364228587.0049
Output for 5.4.35, 5.4.38, 5.5.3, 5.5.7, 5.6.15
1-2345-1364228587.00411-2345-1364228587.0042
Output for 5.5.6, 5.5.30, 5.6.12, 5.6.14
1-2345-1364228587.00481-2345-1364228587.0048
Output for 5.5.29, 5.5.33, 5.6.7, 5.6.13
1-2345-1364228587.00461-2345-1364228587.0046
Output for 5.6.5
1-2345-1364228587.00441-2345-1364228587.0045
Output for 5.5.16, 5.5.24, 5.6.1, 5.6.3
1-2345-1364228587.00471-2345-1364228587.0047
Output for 5.6.2
1-2345-1364228587.00511-2345-1364228587.0051
Output for 5.4.30 - 5.4.31, 5.5.21, 5.6.0
1-2345-1364228587.0041-2345-1364228587.004
Output for 5.5.37
1-2345-1364228587.00291-2345-1364228587.0029
Output for 5.4.45, 5.5.36
1-2345-1364228587.0041-2345-1364228587.0041
Output for 5.4.37, 5.4.39, 5.4.44, 5.5.0, 5.5.12, 5.5.23, 5.5.28, 5.5.35
1-2345-1364228587.00421-2345-1364228587.0042
Output for 5.4.24, 5.5.15, 5.5.20, 5.5.26, 5.5.34
1-2345-1364228587.00441-2345-1364228587.0044
Output for 5.5.4, 5.5.32
1-2345-1364228587.00461-2345-1364228587.0047
Output for 5.4.16, 5.4.32, 5.4.43, 5.5.31
1-2345-1364228587.00381-2345-1364228587.0038
Output for 5.5.27
1-2345-1364228587.0031-2345-1364228587.0031
Output for 5.5.10, 5.5.25
1-2345-1364228587.00411-2345-1364228587.0041
Output for 5.5.19
1-2345-1364228587.00341-2345-1364228587.0035
Output for 5.5.9
1-2345-1364228587.0051-2345-1364228587.005
Output for 5.5.8
1-2345-1364228587.00521-2345-1364228587.0052
Output for 5.4.42
1-2345-1364228587.00331-2345-1364228587.0034
Output for 5.4.17, 5.4.41
1-2345-1364228587.00391-2345-1364228587.004
Output for 5.4.36
1-2345-1364228587.00361-2345-1364228587.0036
Output for 5.4.20, 5.4.34
1-2345-1364228587.00341-2345-1364228587.0034
Output for 5.4.19, 5.4.29
1-2345-1364228587.00361-2345-1364228587.0037
Output for 5.4.27
1-2345-1364228587.00271-2345-1364228587.0027
Output for 5.4.25
1-2345-1364228587.0031-2345-1364228587.003
Output for 5.2.9, 5.3.4 - 5.3.5, 5.3.10, 5.4.2, 5.4.5, 5.4.14
1-2345-1364228587.0021-2345-1364228587.002
Output for 5.3.14, 5.3.26, 5.3.28, 5.4.13
1-2345-1364228587.00221-2345-1364228587.0022
Output for 5.2.11, 5.2.13, 5.3.8, 5.3.24, 5.4.12
1-2345-1364228587.00151-2345-1364228587.0015
Output for 5.4.3, 5.4.11
1-2345-1364228587.00191-2345-1364228587.002
Output for 5.2.3, 5.2.15, 5.3.18, 5.4.7, 5.4.10
1-2345-1364228587.00171-2345-1364228587.0017
Output for 5.1.5, 5.2.6, 5.2.14, 5.4.9
1-2345-1364228587.00161-2345-1364228587.0017
Output for 5.3.29, 5.4.8
1-2345-1364228587.00171-2345-1364228587.0018
Output for 5.4.6
1-2345-1364228587.00141-2345-1364228587.0014
Output for 5.3.15, 5.4.1, 5.4.4
1-2345-1364228587.00211-2345-1364228587.0021
Output for 5.1.4, 5.3.25, 5.4.0
1-2345-1364228587.0021-2345-1364228587.0021
Output for 5.3.20, 5.3.27
1-2345-1364228587.00231-2345-1364228587.0023
Output for 5.1.1 - 5.1.2, 5.2.0, 5.2.16, 5.3.23
1-2345-1364228587.00161-2345-1364228587.0016
Output for 5.2.5, 5.3.22
1-2345-1364228587.00191-2345-1364228587.0019
Output for 5.1.3, 5.2.1 - 5.2.2, 5.2.4, 5.2.12, 5.3.3, 5.3.19, 5.3.21
1-2345-1364228587.00181-2345-1364228587.0018
Output for 5.3.1 - 5.3.2, 5.3.6, 5.3.16 - 5.3.17
1-2345-1364228587.00241-2345-1364228587.0024
Output for 5.3.11, 5.3.13
1-2345-1364228587.00221-2345-1364228587.0023
Output for 5.3.12
1-2345-1364228587.00251-2345-1364228587.0025
Output for 5.1.0, 5.2.17, 5.3.0, 5.3.9
1-2345-1364228587.00141-2345-1364228587.0015
Output for 5.3.7
1-2345-1364228587.00211-2345-1364228587.0022
Output for 5.2.7, 5.2.10
1-2345-1364228587.00111-2345-1364228587.0011
Output for 5.2.8
1-2345-1364228587.00121-2345-1364228587.0012
Output for 5.1.6
1-2345-1364228587.00131-2345-1364228587.0014
Output for 5.0.4 - 5.0.5
1-2345-1364228587.00071-2345-1364228587.0007
Output for 5.0.3
1-2345-1364228587.00061-2345-1364228587.0007
Output for 5.0.2
1-2345-1364228587.00081-2345-1364228587.0008
Output for 5.0.0 - 5.0.1
1-2345-1364228587.00061-2345-1364228587.0006
Output for 4.4.9
1-2345-0.0001131-2345-0.000166
Output for 4.4.8
1-2345-0.000121-2345-0.000164
Output for 4.4.7
1-2345-7.6E-051-2345-0.000109
Output for 4.4.6
1-2345-0.0001291-2345-0.000169
Output for 4.4.5
1-2345-0.0001221-2345-0.000169
Output for 4.4.4
1-2345-0.0001231-2345-0.000172
Output for 4.3.8, 4.4.3
1-2345-9.1E-051-2345-0.000127
Output for 4.4.2
1-2345-7.6E-051-2345-0.000106
Output for 4.4.1
1-2345-0.0001141-2345-0.000159
Output for 4.4.0
1-2345-0.0001361-2345-0.000182
Output for 4.3.11
1-2345-0.0001111-2345-0.00015
Output for 4.3.10
1-2345-0.0001321-2345-0.000176
Output for 4.3.9
1-2345-0.0001391-2345-0.000186
Output for 4.3.7
1-2345-0.0001341-2345-0.000175
Output for 4.3.6
1-2345-0.0001331-2345-0.000179
Output for 4.3.5
1-2345-0.0001271-2345-0.000172
Output for 4.3.4
1-2345-0.0001161-2345-0.00016
Output for 4.3.3
1-2345-0.0001081-2345-0.000159
Output for 4.3.2
1-2345-9.8E-051-2345-0.000137
Output for 4.3.1
1-2345-0.0001421-2345-0.000208
Output for 4.3.0
1-2345-0.000131-2345-0.00018

preferences:
181.53 ms | 401 KiB | 242 Q