From c3cc11f2a81411acf5e500285836c8f7744546e1 Mon Sep 17 00:00:00 2001 From: Malcolm Fell Date: Fri, 28 Jun 2013 08:57:25 +1200 Subject: [PATCH] Add description of typecasting --- php.html.markdown | 4 ++++ 1 file changed, 4 insertions(+) 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;