diff options
author | Malcolm Fell <malcolm@vendhq.com> | 2013-06-28 08:57:25 +1200 |
---|---|---|
committer | Malcolm Fell <malcolm@vendhq.com> | 2013-06-28 08:57:25 +1200 |
commit | c3cc11f2a81411acf5e500285836c8f7744546e1 (patch) | |
tree | 4d0eab4215032e2e02ce09047c0589f61c9bd99c /php.html.markdown | |
parent | 34852cc8be15e4ba643001dac8c0c0ca1ac48dca (diff) |
Add description of typecasting
Diffstat (limited to 'php.html.markdown')
-rw-r--r-- | php.html.markdown | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/php.html.markdown b/php.html.markdown index 57470390..d08b9220 100644 --- a/php.html.markdown +++ b/php.html.markdown @@ -144,7 +144,11 @@ echo $string + $string; // Also outputs 2 because the + operator converts the st $string = 'one'; echo $string + $string; // Outputs 0 because the + operator cannot cast the string 'one' to a number +``` + +Type casting can be used to treat a variable as another type temporarily by using cast operators in parentheses. +```php $boolean = (boolean) $integer; // $boolean is true $zero = 0; |