0

I have the following line:

$ar = split("\r?\n", $str);

Because split is deprecated I search for an alternarive. And tried:

$ar = preg_split("/\r?\n/", $str);

Is this the same as the above?

The main question is not if preg_split is an possible alternative for the deprecated function split. The question is if the result with the regex I used for preg_split is the same as the one used for split

EDIT: I tested some use cases and it seems to be equivalent.

TmCrafz
  • 184
  • 1
  • 12

0 Answers0