Type casting, a very old (pre-dating C++ all the way to C), syntax was in fact inherited by PHP. You can force a type on any value, even though in PHP types are very loose, so that if a function from some random library requires a certain type, it will not warn you or error out. This is very useful when ensuring that your releases do not contain errors, warnings or notices.
This technique only works for basic types: bool, string, integer, and foat, The following is the syntax:
(
ie.: (string)$var
Hope this helps in the future of everyone's programming endeavors.
Loushou.
No comments:
Post a Comment