As we know PHP does not require or support explicit type definition in variable declaration. However, you can force a variable to be evaluated as a certain type using type casting.
Let's try out the following example to understand how this works:
<?php
$num = "2.75";
// Cast to integer
$int = (int)$num;
echo gettype($int); // Outputs: integer
echo $int; // Outputs: 2
// Cast to float
$float = (float)$num;
echo gettype($float); // Outputs: double
echo $float; // Outputs: 2.75
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to disable all input controls inside a form using jQuery
Use the jQuery prop() method...How to create jQuery slide left and right toggle effect
Use the jQuery animate() metho...VueJs CRUD Example using MongoDB | Express.js | Vue.js | Node.js
This is a step by step MEVN stack tutori...PHP Find Key of Minimum value in Given Array
On working with huge data, sometimes you...How to Trigger a Click on a Link Using jQuery
Use the jQuery click() Method You can...