String replacing with regular expression

suggest change
$string = "a;b;c\nd;e;f";
// $1, $2 and $3 represent the first, second and third capturing groups
echo preg_replace("(^([^;]+);([^;]+);([^;]+)$)m", "$3;$2;$1", $string);

Outputs

c;b;a
f;e;d

Searches for everything between semicolons and reverses the order.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents