What is type casting and type juggling in PHP?

Posted by Prem Tiwari | Updated on

What is type casting and type juggling in PHP?

The way by which PHP can assign a particular data type for any variable is called typecasting. The required type of variable is mentioned in the parenthesis before the variable.

Sample code:

PHP does not support datatype for variable declaration. The type of the variable is changed automatically based on the assigned value and it is called type juggling.

Sample code:


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers