3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = 'chat @julio "salut à toi" hey "1 2 3" hoho'; $str = '<?php ' . str_replace( '@', '*', $str ); $a=token_get_all($str); array_shift( $a ); $a = array_column( $a, 1 ); $a = array_map( 'trim', $a ); $a = array_filter( $a ); $a = array_values( $a ); list( $subcommand, $user, $args ) = array_merge( array_splice( $a, 0, 2 ), array_splice( $a, 2 ) ); var_dump($subcommand); var_dump($user); var_dump($args);
Output for 5.6.30
string(4) "chat" string(5) "julio" string(7) ""1 2 3""