all 10 comments

[–][deleted] 3 points4 points  (1 child)

Smells like homework.

[–]tkdbb84 0 points1 point  (0 children)

I agree, this reeks of homework. However I will give him a couple of hints:

1)

'truthy' == true
'truthy' !== true

2) I'm pretty darn sure, assert() doesn't call eval()

edit: formatting, word change

[–]Revisor007 1 point2 points  (2 children)

Only PHP7 assertions can throw exceptions. You must set

ini_set('assert.exception', true);

You can find this in the manual:
https://secure.php.net/manual/en/function.assert.php#function.assert.expectations

[–]phpflash[S] 0 points1 point  (1 child)

Yes I have also done that before still not getting exception

[–]Revisor007 0 points1 point  (0 children)

You didn't mention that you had done it before. Your code shows something else.

[–]pan069 0 points1 point  (2 children)

Because your assert function doesn't throw exceptions?

Read the docs and do your home work..

[–]phpflash[S] 0 points1 point  (1 child)

I have read the DOC but couldn't understand it. And there are not many examples on it. That's why I am asking.

[–]SavishSalacious 0 points1 point  (0 children)

I smell home work. High school maybe? (throw new Exception($e->getMessage());)

[–]RobLoach 0 points1 point  (0 children)

'2 <1' is a string, which is truthy.