Sample text:
$text = \'Administration\\Controller\\UserController::Save\';
Task - extract everything before ::
Option 1:
Using the time
command on Linux. The first one measured in at 0m0.024s
and the second at 0m0.011s
.
The second one appears to be faster. I ran it multiple times and the result (bar one time) seemed to be the same.
EDIT: As suggested, the other user said to run it in a loop of 5000. That completed with the same results.