What does type casting mean in php? Explain with an example?



What does type casting mean in php? Explain with an example?..

Answer / Pradeep Kumar Rai

Type casting in PHP is a way to explicitly convert data from one type to another. This can be achieved using various built-in functions such as (int), (float), (string), (boolean), (array) etc.nExample: To convert the value of a variable $x containing a string '5' into an integer, use the following statement:
n(int) $x;
After executing this, the value of $x will be 5.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

How to find a substring from a given string in php?

1 Answers  


What is the use of array_count_values() in php?

1 Answers  


How many records can be stored in mysql table?

1 Answers  


How long is csrf token?

1 Answers  


What is the difference between the functions unlink and unset?

8 Answers   Small Firm, TCS,


Explain how you can update memcached when you make changes to php?

1 Answers  


Is php faster than javascript?

1 Answers  


What is a trait in php?

1 Answers  


Which function would you use to insert a record into a database in php?

1 Answers  


Do you know how to enable error reporting in php?

1 Answers  


When sessions ends?

1 Answers  


What is the main function of php?

1 Answers  


Categories