$ foo = " 1 "; // $foo is a string type.
$ bar =(int)$ foo; // $bar is an integer
2. Built-in function mode
$ foo = " 1 "; // $foo is a string type.
$ bar = intval($ foo); // $bar is an integer
3. Format string mode
$ foo = " 1 "; // $foo is a string type.
$bar = sprintf("%d ",$ foo); // $bar is a string type