note 12225 modified in control-structures.switch by vrana

From: Date: Tue, 17 Aug 2004 13:55:04 +0000
Subject: note 12225 modified in control-structures.switch by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79943@lists.php.net to get a copy of this message
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. --was-- just a further example of the above note, you can do the following type of searching: 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. http://php.net/manual/en/control-structures.switch.php

« previous php.notes (#79943) next »