3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function find_date( $string ) { //Define month name: $month_names = array( "january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december" ); $month_number=$month=$matches_year=$year=$matches_month_number=$matches_month_word=$matches_day_number=""; //Match dates: 01/01/2012 or 30-12-11 or 1 2 1985 preg_match( '/([0-9]?[0-9])[\.\-\/ ]?([0-1]?[0-9])[\.\-\/ ]?([0-9]{2,4})/', $string, $matches ); if ( $matches ) { if ( $matches[1] ) $day = $matches[1]; if ( $matches[2] ) $month = $matches[2]; if ( $matches[3] ) $year = $matches[3]; } //Match month name: preg_match( '/(' . implode( '|', $month_names ) . ')/i', $string, $matches_month_word ); echo ($matches_month_word[1]);exit; if ( $matches_month_word ) { if ( $matches_month_word[1] ) $month = array_search( strtolower( $matches_month_word[1] ), $month_names ) + 1; } //Match 5th 1st day: preg_match( '/([0-9]?[0-9])(st|nd|th)/', $string, $matches_day ); if ( $matches_day ) { if ( $matches_day[1] ) $day = $matches_day[1]; } //Match Year if not already setted: if ( empty( $year ) ) { preg_match( '/[0-9]{2}/', $string, $matches_year ); if ( $matches_year[0] ) $year = $matches_year[0]; } if ( ! empty ( $day ) && ! empty ( $month ) && empty( $year ) ) { preg_match( '/[0-9]{2}/', $string, $matches_year ); if ( $matches_year[0] ) $year = $matches_year[0]; } $day = '01'; //Leading 0 if ( 1 == strlen( $day ) ) $day = '0' . $day; //Leading 0 if ( 1 == strlen( $month ) ) $month = '0' . $month; //Check year: if ( 2 == strlen( $year ) && $year > 20 ) $year = '19' . $year; else if ( 2 == strlen( $year ) && $year < 20 ) $year = '20' . $year; $date = array( 'year' => $year, 'month' => $month, 'day' => $day ); //Return false if nothing found: if ( empty( $year ) && empty( $month ) && empty( $day ) ) return false; else return date('Y-m-d',strtotime($date['year'].'-'.$date['month'].'-01')); } echo find_date('Fund Factsheet Syariah - Jan 1914');
based on TZcs1

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).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.60.0030.00817.04
7.2.00.0030.00919.49
7.1.200.0000.01216.00
7.1.100.0040.01118.28
7.1.70.0060.00317.44
7.1.60.0140.01119.48
7.1.50.0060.01917.31
7.1.00.0030.07722.48
7.0.200.0030.00516.97
7.0.60.0070.04019.95
7.0.50.0030.08718.00
7.0.40.0030.09720.23
7.0.30.0170.07020.09
7.0.20.0330.07720.40
7.0.10.0100.08720.10
7.0.00.0030.06320.20
5.6.280.0030.07321.05
5.6.210.0030.08320.73
5.6.200.0030.04718.16
5.6.190.0030.04720.67
5.6.180.0170.04720.61
5.6.170.0270.03320.54
5.6.160.0100.04720.47
5.6.150.0070.06718.15
5.6.140.0100.03318.15
5.6.130.0000.04318.14
5.6.120.0030.05720.96
5.6.110.0030.05721.04
5.6.100.0130.07721.16
5.6.90.0070.04720.90
5.6.80.0130.04320.42
5.5.350.0070.03020.46
5.5.340.0000.05017.99
5.5.330.0030.05320.43
5.5.320.0030.07720.46
5.5.310.0330.07020.30
5.5.300.0070.06317.98
5.5.290.0070.08017.93
5.5.280.0070.04320.98
5.5.270.0130.07320.98
5.5.260.0030.07720.82
5.5.250.0070.04720.71
5.5.240.0100.03320.25
5.4.450.0630.03719.18
5.4.440.0670.06019.58
5.4.430.0130.05319.31
5.4.420.0030.06019.39
5.4.410.0200.04019.46
5.4.400.0070.05719.10
5.4.390.0170.04719.06
5.4.380.0100.05719.25
5.4.370.0130.05019.20
5.4.360.0070.05319.11
5.4.350.0030.07319.09
5.4.340.0100.05319.11
5.4.320.0070.05719.07
5.4.310.0130.04719.05
5.4.300.0100.05019.03
5.4.290.0100.05019.04
5.4.280.0100.05019.05
5.4.270.0130.04719.24
5.4.260.0130.05019.05
5.4.250.0070.05719.08
5.4.240.0170.04719.05
5.4.230.0100.05019.23
5.4.220.0100.05319.23
5.4.210.0170.05018.95
5.4.200.0030.05716.94
5.4.190.0100.05319.00
5.4.180.0100.05319.07
5.4.170.0100.05719.04
5.4.160.0130.04719.02
5.4.150.0130.05019.04
5.4.140.0130.04716.48
5.4.130.0100.05016.22
5.4.120.0070.05316.38
5.4.110.0130.05716.23
5.4.100.0030.06016.25
5.4.90.0130.04716.56
5.4.80.0200.03716.38
5.4.70.0070.05016.26
5.4.60.0030.05716.59
5.4.50.0130.04316.54
5.4.40.0030.06316.31
5.4.30.0130.04316.39
5.4.20.0130.06016.53
5.4.10.0100.04716.35
5.4.00.0100.05015.67
5.3.290.0130.04714.71
5.3.280.0130.05014.80
5.3.270.0070.05314.85
5.3.260.0100.05314.85
5.3.250.0130.04714.59
5.3.240.0070.05314.59
5.3.230.0170.04714.54
5.3.220.0030.05714.66
5.3.210.0030.06014.50
5.3.200.0030.05714.55
5.3.190.0130.06314.47
5.3.180.0100.05014.71
5.3.170.0170.04314.77
5.3.160.0130.05014.81
5.3.150.0100.05314.68
5.3.140.0100.05714.76
5.3.130.0130.05014.74
5.3.120.0070.06014.68
5.3.110.0030.06014.54
5.3.100.0130.05314.15
5.3.90.0170.05014.03
5.3.80.0030.05714.06
5.3.70.0200.04713.99
5.3.60.0130.04714.24
5.3.50.0100.07014.01
5.3.40.0100.05014.02
5.3.30.0100.05013.90
5.3.20.0170.04013.69
5.3.10.0070.05313.71
5.3.00.0030.05713.73
5.2.170.0170.03311.25
5.2.160.0100.03711.39
5.2.150.0030.04311.36
5.2.140.0170.04311.20
5.2.130.0030.04311.11
5.2.120.0070.04311.05
5.2.110.0130.03311.09
5.2.100.0000.04711.10
5.2.90.0070.04011.19
5.2.80.0070.04311.19
5.2.70.0100.04011.16
5.2.60.0070.04011.06
5.2.50.0000.04711.07
5.2.40.0130.03311.06
5.2.30.0030.04310.92
5.2.20.0000.04711.17
5.2.10.0100.03710.87
5.2.00.0070.04010.71
5.1.60.0100.03010.13
5.1.50.0030.0379.95
5.1.40.0030.03710.06
5.1.30.0000.04310.34
5.1.20.0100.03310.45
5.1.10.0070.03710.14
5.1.00.0100.03010.09
5.0.50.0070.0278.64
5.0.40.0030.0278.34
5.0.30.0030.0438.25
5.0.20.0000.0338.38
5.0.10.0000.0338.35
5.0.00.0070.0408.23
4.4.90.0070.0205.99
4.4.80.0130.0105.88
4.4.70.0100.0175.87
4.4.60.0100.0175.99
4.4.50.0130.0175.95
4.4.40.0030.0375.79
4.4.30.0030.0235.87
4.4.20.0000.0275.88
4.4.10.0030.0276.04
4.4.00.0070.0335.95
4.3.110.0000.0235.83
4.3.100.0030.0205.72
4.3.90.0000.0235.70
4.3.80.0070.0305.83
4.3.70.0070.0175.70
4.3.60.0000.0235.72
4.3.50.0030.0275.82
4.3.40.0070.0305.77
4.3.30.0000.0234.55
4.3.20.0000.0234.62
4.3.10.0030.0204.48
4.3.00.0270.01316.00