getting array slice of function output

From: Date: Wed, 05 Nov 2003 21:10:33 +0000
Subject: getting array slice of function output
Groups: php.general 
Request: Send a blank email to php-general+get-168623@lists.php.net to get a copy of this message
Hi, all -- I have a line which strips the suffix (gif, GIF, TIFF, jpg, JPEG, etcetc or I would just use basename() :-) from a string but it seems needlessly drawn out: $file = preg_split('/\./',$dirfiles[0]) ; $file = $file[0] ; I would like to just assign the 0th element of the preg_split() output to my variable. I've also had to use a temp array for stat() output in other places. Is there a way to address preg_split('/\./',$string[0])[0] or stat("$somefile")[mode] directly instead? TIA & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.general (#168623) next »