May 2023
Intermediate to advanced
431 pages
8h 55m
English
Dynamically interpreted languages, such as PHP, are known for their flexibility and ease of use but not necessarily for their speed. This is partly because of the way their type systems work. When types are inferred at runtime, it’s impossible for the parser to know exactly how to perform a certain operation until it’s provided with data.
Consider the following, loosely typed PHP function to add two items together:
functionadd($a,$b){return$a+$b;}
Since this function does not declare the types for the variables passed in or the return type, it can exhibit multiple signatures. All of the method signatures in Example 14-1 are equally valid ways to call the preceding function.
Read now
Unlock full access