TeamPhotoshop
Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
Forum Home Latest Posts Search Help Subscribe

php questions

Page: 1 Reply
Oct 5th 2004#161111 Report
Member since: Mar 18th 2001
Posts: 1690
Ok, some of you may remember the script I wrote a while back that queries a directory and returns the full filename as a link which you can click on and then view/listen to the file.

well, I now have another issue that I need to work out to incorporate a feature into the script.

I need to be able to read a string of text from the file name and print it out into a table cell next to the filename.

basically, works like this.

filename is: (im making this up. this is not the actual filename, but it represents what the filename looks like. all files are named in this convention.)

JIMBOB77_1004_8888888888_11.wav

Now, the string of text I need to read out is 'JIMBOB77'. The issue is, that not every filename starts with JIMBOB77. Some may start with BETTYSUE99. So. Is there anywhere I can read out the string of text from the filename up to but not including the underscore '_'? At which point, I will print that string out in a table cell next to the actual filename.
Reply with Quote Reply
Oct 5th 2004#161112 Report
Member since: Mar 18th 2001
Posts: 6632
I assume it would be something having to do with regular expressions, but they confuse the hell out of me.

http://www.phpbuilder.com/columns/dario19990616.php3
Reply with Quote Reply
Oct 5th 2004#161121 Report
Member since: Apr 20th 2002
Posts: 3000
Given that the file name is contained in a string $string:
[PHP]/* hot secks */
$array = explode("_", $string);
$filename = $array[0];
[/PHP]
Reply with Quote Reply
Page: 1 Back to top
Please login or register above to post in this forum