Skip to main content

PHP Type Casting

Body

In this tutorial, we’re going to discuss about PHP Type Casting. We can call Type casting or Type Switching or Type Juggling. The idea here is that, out of all types we’ve been working in PHP such numbers or strings, we can actually switch from one type to another.
To start this application lets create a new PHP file called “typecasting.php”. And add the following code.

The PHP code below is trying to combine the string value of 10 to 4. Then we echo the variable value and it returns 14 meaning it will able to perform a mathematical operation. But this is a bad programming because we don

Add new comment