xiaozi 2014-11-21 22:12:00

php 中,`switch`是弱类型比较,可使用```swicth (true) { case $a === 'val1': break; }```

<?php

$a = 1;

switch (true) {

	case $a === true:
		echo 'hello strict case';
	break;
	
	default:
		echo 'I\'m default echo.';

}

评论

Home - Wiki
Copyright © 2011-2024 iteam. Current version is 2.138.0. UTC+08:00, 2024-12-22 11:44
浙ICP备14020137号-1 $Map of visitor$