Bonjour,
$string = "lundi: 10:00 – 19:00"
Je veux couper la string pour en avoir 3:
$s1 = "lundi"$s2 = "10:00"$s3 = "19:00"
Comment je peux faire ?
Merci.
preg_mach
avec un regex du genre :(\w): (\d:\d) - (\d:\d)
(\w): (\d:\d) - (\d:\d)
https://regexr.com/
essaye ;)
Avec explode mais il faut virer le tiret entre les 2 heures:
$string = "lundi: 10:00 19:00";
$strings = explode(" ", $string);
echo $strings[0]; echo $strings[1]; echo $strings[2];