Created
December 27, 2011 15:39
-
-
Save elct9620/1524052 to your computer and use it in GitHub Desktop.
PHP Switch 新用法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = array('type', 'apple'); | |
switch(true){ | |
case in_array('apple', $array): | |
echo 'Have Apple'; | |
case in_array('mango', $array): | |
echo 'Have Mongo'; | |
default: | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
過一段時間回來看發現其實這做法應該會⋯⋯很慢 Orz
每次都做 Function Call 會悲劇吧 XDD