Re: Regexp question...

From: Date: Wed, 28 May 2003 08:03:03 +0000
Subject: Re: Regexp question...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149196@lists.php.net to get a copy of this message
Andrew D. Luebke wrote:
OK, here is the regexp command I am trying to use:
    $split_filename = preg_split('/\./', $_FILES["userfile"]["name"], -1);
However, when I do a count($split_filename) I don't get what I expect. For instance if the input is:
    abc.xyz.123
I get 2 from count, why doesn't preg_split put three elements in the array? It works since I'm actually looking for the last part of the filename. Thanks for any help.
If you're looking for the file extension, use pathinfo() instead. To actually answer your question, have you tried using print_r() to get the contents of the array? -- David Grant Web Developer david.grant@wiredmedia.co.uk http://www.wiredmedia.co.uk Tel: 0117 930 4365, Fax: 0870 169 7625 Wired Media Ltd Registered Office: 43 Royal Park, Bristol, BS8 3AN Studio: Whittakers House, 32 - 34 Hotwell Road, Bristol, BS8 4UD Company registration number: 4016744 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************

« previous php.general (#149196) next »