note 12225 deleted from control-structures.switch by peehaa
| From: | peehaa@php.net | Date: | Mon, 02 Dec 2013 09:12:04 +0000 |
| Subject: | note 12225 deleted from control-structures.switch by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197697@lists.php.net to get a copy of this message | ||
Note Submitter: rtreat2 at tampabay dot rr dot com
----
just a further example of the above note, you can do the following type of searching:
<?php
switch (true){
case ( ereg ("stats",$userfile_name) ):
echo "processing stats";
process_stats();
break;
case ( ereg("prices",$userfile_name) ):
echo "processing prices";
process_prices();
break;
default:
echo = "File not recognized!!.";
}
?>
this script could be used to determine data formats for uploaded files based on a nameing conve
ntion. just one example.