Splitting a String into an Array Using Regular Expressions in PHP

preg_split
Задание 1

Given a string with different delimiters:

php<?php
  $str = "apple,banana;cherry|date orange";
?>

Split the string into an array using the following as delimiters: comma, semicolon, vertical bar, and space.

Задание 2

Given a string:

php<?php
  $str = '2025-12-31 12:30:45';
?>

Get an array of all parts of the date.

Задание 3

Given a string:

php<?php
  $str = 'first.second.third.forth';
?>

Split the string into an array by dots, but only the first three times.