note 14792 rejected and deleted from function.split.php by alindeman

From: Date: Wed, 15 Aug 2001 20:43:58 +0000
Subject: note 14792 rejected and deleted from function.split.php by alindeman
Groups: php.notes 
Request: Send a blank email to php-notes+get-16762@lists.php.net to get a copy of this message
[ Editor's Note: This is because split() accepts a regular expression. "." (period) represents the match anything, so you have to escape it if you want to actually split something with a period. alindeman@php.net ] Perhaps someone can tell me about this one I ran across. I was trying to split a filename by the periods that it contained so that I could get the extension and print a nifty image that corresponded. I used this code: $row = split('.',$filename); $extension = strtolower($row[sizeof($row)-1]); $docsize = getdocsize($dbh,$studentdocids[$i]); Well, $row ended up being empty until I changed the first line to be the following: $row = split('.',$filename); I haven't seen this mentioned anywhere, so I figured that I would mention when in doubt, use the backslash.

« previous php.notes (#16762) next »