Skip to content

Instantly share code, notes, and snippets.

@gr1ev0us
Created March 7, 2017 17:13
Show Gist options
  • Save gr1ev0us/a44535e32522b2d3779bb5e08e5d9004 to your computer and use it in GitHub Desktop.
Save gr1ev0us/a44535e32522b2d3779bb5e08e5d9004 to your computer and use it in GitHub Desktop.
<?php
$list=
'
8.3.2017
15.3.2017
21.3.2017
27.3.2017
'
;
$date1 = '7.3.2017';
$date2 = '27.3.2017';
echo preg_quote($date1) . PHP_EOL;
$regex = '#^'.preg_quote($date1).'$#m';
var_dump(preg_match($regex, $list));
echo preg_quote($date2) . PHP_EOL;
$regex = '#^'.preg_quote($date2).'$#m';
var_dump(preg_match($regex, $list));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment