3 ms·
I'm assuming the check happens at compile time (and therefore cached in the opcache, which you should be using in production anyway)
by derision 7y ago
I'm assuming the check happens at compile time (and therefore cached in the opcache, which you should be using in production anyway)
- lowercased 7y agoi would think you'd still have dynamic check - trying to set a string in to an integer type would happen at runtime - you'd be checking before each set call. I'm not sure you'd be able to catch all the runtime potential issues ahead of time (but I've not kept up with php internals for awhile - perhaps someone's got a good way to do that now?)
- namibj 7y agoWhat I remember from reading master a few months ago: the zend VM can specialize ops already, trading size of the op-implementations against type-check-elision/fusion by GCC/clang. I think eliding redundant type checks at least won't be hard when confined to a single php function.