$the_value = '42';
This is a string value. Now I want to convert it into int and obtain:
$the_value = 42;
$the_value = '42';
This is a string value. Now I want to convert it into int and obtain:
$the_value = 42;
To convert string to int in PHP, you can use Type Casting method or PHP built-in function intval().
<?php
$string = "56";
$int = intval( $string );
echo $int;
?>