Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Minor nits:

1. "they all inherit from stdClass" -- this is simply not true

2. callables should've mentioned anonymous functions

3. a special typed value can't be casted to anything. -- this is not true, NULLs can be casted to anything (it becomes 0, "", array() ) and even resources can be casted to anything with dubious utility value.

4. casting should mention the intval() , strval() , doubleval() functions

5. php does not support explicit type definition in variable declaration -- PHP 7.4 however supports typed properties. https://wiki.php.net/rfc/typed_properties_v2



I'll definitely edit the post adding the relevant bits you mentioned.

Two special notes:

About 1. stdClass, you're right and I don't know why I just took it for granted without even testing. My Bad.

About 3. casting special types, you're right again. I didn't phrase it properly. Casting null to other types won't yield errors and casting resources too. Their values are normally nothing we should rely on, but doesn't mean one "can't" perform such casts.

Thanks a lot for your comments, they are incredibly helpful! Cheers!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: