Answers for "php intval"

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
1

setinterval php

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

string to int php

$str = "10";
$num = (int)$str;
Posted by: Guest on December-17-2020
0

php "?int"

// ? means $count can be NULL or integer, maybe PHP >=7.4
private ?int $count
Posted by: Guest on January-01-2021
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