php get integer from string code example
Example 1: php string to int
intval($string);
Example 2: php to int
$num = "3.14";
$int = (int)$num;
Example 3: get numbers from string php
phpCopy<?php
$string = 'Sarah has 4 dolls and 6 bunnies.';
preg_match_all('!\d+!', $string, $matches);
print_r($matches);
?>