string to int php
snippet in php

php string to int

user7228

intval($string);

convert string to int php

user3737

s = "123";
echo intval(s); // 123

s = "hello";
echo intval(s);	//0

php float to int

user2544

$int = intval($float);

cast string to int php

user7115

$num = "3.14"; 
$int = (int)$num;//string to int
$float = (float)$num;//string to float

convert to int php

user6774

$myintvariable = intval($myvariable);

string to int php

user1561

$str = "10";
$num = (int)$str;