⊗ppPmRgASE 270 of 447 menu

Splitting a String into an Array Using Regular Expressions in PHP

preg_split

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.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline