Answers for "intval in php"

PHP
43

php string to int

intval($string);
Posted by: Guest on February-20-2020
1

setinterval php

setInterval(function(){
       echo "hi!\n";
}, 1000);
Posted by: Guest on October-16-2020
8

php to int

$num = "3.14";
$int = (int)$num;
Posted by: Guest on April-13-2020
1

setinterval php

function setInterval($f, $milliseconds)
{
       $seconds=(int)$milliseconds/1000;
       while(true)
       {
           $f();
           sleep($seconds);
       }
}
Posted by: Guest on October-16-2020
0

echo intval

<?php
echo intval(42);                      // 42
echo intval(4.2);                     // 4
echo intval('42');                    // 42
echo intval('+42');                   // 42
echo intval('-42');                   // -42
echo intval(042);                     // 34
echo intval('042');                   // 42
echo intval(1e10);                    // 1410065408
echo intval('1e10');                  // 1
echo intval(0x1A);                    // 26
echo intval(42000000);                // 42000000
echo intval(420000000000000000000);   // 0
echo intval('420000000000000000000'); // 2147483647
echo intval(42, 8);                   // 42
echo intval('42', 8);                 // 34
echo intval(array());                 // 0
echo intval(array('foo', 'bar'));     // 1
echo intval(false);                   // 0
echo intval(true);                    // 1
?>
Posted by: Guest on January-14-2021

Browse Popular Code Answers by Language