PHP equivelant of Perl line?
Can someone tell me if I'm right with this? I'm trying to port a fairly massive perl script into OO-PHP, and have been stuck on a few things, this is one of them and just need some confirmation if I'm doing it right, the perl code is:
is this the same as doing this in PHP?
list($command, $args) = preg_split('/\n/', $message);
No. What you're trying to do is invalid and will not work. The equivalent PHP code would be:
$args = preg_split('/\n/', $message); $command = array_shift($args);
The use of preg_ functions should be only used when necessary, so you could actually replace the preg_split with: