Thursday, March 28, 2019

php - Why not output I hope result in PHP7 using try and catch?

In PHP7 env, I have the follow code:



try {
echo strlen([123]);
} catch (Exception $e) {
echo 'error...';
}


Because [123] is not string, I want it to output error..., but it outputs:



Warning: strlen() expects parameter 1 to be string, array given


Why?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...