<?php
$data = 'a:4:{i:0;O:8:"stdClass":2:{s:3:"aaa";a:2:{i:0;s:4:"test";i:1;i:2;}s:3:"aaa";i:3;}i:2;i:4;i:3;i:5;s:3:"ccc";R:4;}';
$x = unserialize($data);
//var_dump($x);
var_dump(in_array($x['ccc'], array('test')));
if(is_string($x['ccc']) && in_array($x['ccc'], array('test'))) {
$a = 'hahahaha';
$b = 'b';
var_dump($x['ccc']);
echo 'haha';
} else {
echo 'fuck';
}
- Output for 5.4.36 - 5.4.45, 5.5.20 - 5.5.38, 5.6.4 - 5.6.38, 7.0.0 - 7.0.31, 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
- bool(true)
string(4) "test"
haha
- Output for 5.4.0 - 5.4.35, 5.5.0 - 5.5.19, 5.6.0 - 5.6.3
- NULL
NULL
haha
preferences:
251.94 ms | 402 KiB | 333 Q