Explode/Implode array

From: Date: Fri, 23 Aug 2002 17:55:13 +0000
Subject: Explode/Implode array
Groups: php.general 
Request: Send a blank email to php-general+get-113824@lists.php.net to get a copy of this message
Hi, I want to explode a string (actually a path) and then implode it again after removing the first element. For example, given "path/to/myfile.txt" I want to have two results, "path" and "to/myfile.txt", call them res1 and res2. If there is only one element in the array '$list' then res2 should be set to "". I have $path = "path/to/myfile.txt"; $list = explode( "/", $path ); $res1 = $list[0]; if (count($list)<1) res2 = ""; else $res2 = implode("/",$list); but I know this isn't right, I have to remove $list[0] from $list first. How do I do this? Thanks Rich

« previous php.general (#113824) next »