What does type casting mean in PHP? Explain with an example?
Page 1 of 1
What does type casting mean in PHP? Explain with an example?
PHP automatically store the data and interprets according to itself. Type casting is a way to assign the variable according to your need and requirement and not allowing PHP to assign it automatically. To specify the type, it can be used like:
$newint = (int) $var1;
$newfloat = (float) $var1;
$newstring = (string) $var1;
The value in the variable on the right side of the equal sign is stored in the variable on the left side as the specified type.
Similar topics
» What is a type library?
» What is the type of “this” pointer? When does it get created?
» Explain the problem with COM.
» What is Stack? Explain its uses
» Explain abstraction.
» What is the type of “this” pointer? When does it get created?
» Explain the problem with COM.
» What is Stack? Explain its uses
» Explain abstraction.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|