String to array

How might I convert a url (ex. /test1/test2/test3) to be in an array as array(“test1”, “test2”, “test3”) using the / as a seperator.

echo '<pre>',print_r( explode('/', trim('/test1/test2/test3','/') ) ),'</pre>';

Also, implode does the opposite (converts an array to a string separated by the character of your choice).