SnakZ Posted February 15, 2011 Share Posted February 15, 2011 can anyone tell me if this is the right way to rewrite this split ?? $exts = split("[/\\.]", $q) ; to $exts = preg_split("[\\.]", $q) ; function findexts ($q) { $q = strtolower($q) ; $exts = split("[/\\.]", $q) ; $n = count($exts)-1; $exts = $exts[$n]; return $exts; } ty you for any help with this Link to comment https://forums.phpfreaks.com/topic/227805-split-to-preg_split-need-help-please/ Share on other sites More sharing options...
requinix Posted February 16, 2011 Share Posted February 16, 2011 Forward slash and period, right? '#[/.]#' But if you're pulling a filename extension, substr(strrchr($string, "."), 1) (or one of a billion other methods that don't involve arrays) Link to comment https://forums.phpfreaks.com/topic/227805-split-to-preg_split-need-help-please/#findComment-1174775 Share on other sites More sharing options...
SnakZ Posted February 16, 2011 Author Share Posted February 16, 2011 Forward slash and period, right? '#[/.]#' But if you're pulling a filename extension, substr(strrchr($string, "."), 1) (or one of a billion other methods that don't involve arrays) yeah im pulling the file extension to see if its the right ext for uploading but im not to sure how your code works or how to even input it into the the function sorry this function is something i grab off a php helper site so im not sure how it works Link to comment https://forums.phpfreaks.com/topic/227805-split-to-preg_split-need-help-please/#findComment-1174787 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.