The case expression may be any expression that evaluates to a simple type, that is, integer or floating-point numbers and strings. Arrays or objects cannot be used here unless they are dereferenced to a simple type.
Arrays are always converted to the string «Array»; because of this, echo and print can not by themselves show the contents of an array.
$testArray = array('BBB', 'BBB');
$array1 = array('AAA', 'AAA');
$array2 = array('BBB', 'BBB');
switch($testArray) {
case $array1:
echo 'First<br />';
case $array2:
echo 'Second<br />';
}
CREATE TABLE `user_notification` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(10) unsigned NOT NULL DEFAULT '0',
`article_id` int(10) unsigned NOT NULL DEFAULT '0',
`magazine_id` int(10) unsigned NOT NULL DEFAULT '0',
`user_page_id` int(10) unsigned NOT NULL DEFAULT '0',
`date_time` datetime NOT NULL,
`unix_date` int(10) unsigned NOT NULL,
`comment_id` int(10) unsigned NOT NULL,
`is_subscribed` enum('1','0') COLLATE utf8_unicode_ci NOT NULL,
`status` enum('send','not_send') COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_id` (`user_id`,`article_id`,`magazine_id`,`user_page_id`)
) ENGINE=MyISAM AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
function is_ref_to(&$a, &$b)
{
$t = $a;
if($r=($b===($a=1))){ $r = ($b===($a=0)); }
$a = $t;
return $r;
}