Splitting a String into an Array Using Regular Expressions in PHP
Given a string with different delimiters:
<?php
$str = "apple,banana;cherry|date orange";
?>
Split the string into an array using the following as delimiters: comma, semicolon, vertical bar, and space.
Given a string:
<?php
$str = '2025-12-31 12:30:45';
?>
Get an array of all parts of the date.
Given a string:
<?php
$str = 'first.second.third.forth';
?>
Split the string into an array by dots, but only the first three times.