 
      
    PHP
- 101 ответ
- 0 вопросов
    63
    Вклад в тег
    
      
      
    
  
  
function foo($x) {
    $result = 0;
    for ($i = 0; $i < 100; $i++) {
        $result += $i + $x;
    }
    return $result;
}~$ time php70 -r 'function foo($x) { $result = 0; for ($i = 0; $i < 10000000; $i++) { $result += $i + $x; } } foo("123");'
real    0m0.860s
user    0m0.855s
sys     0m0.005s~$ time php70 -r 'function foo($x) { $result = 0; for ($i = 0; $i < 10000000; $i++) { $result += $i + $x; } } foo(123);'
real    0m0.508s
user    0m0.500s
sys     0m0.008s~$ time php70 -r 'function foo(int $x) { $result = 0; for ($i = 0; $i < 10000000; $i++) { $result += $i + $x; } } foo("123");'
real    0m0.502s
user    0m0.498s
sys     0m0.003s~$ time php70 -r 'function foo(int $x) { $result = 0; for ($i = 0; $i < 10000000; $i++) { $result += $i + $x; } } foo(123);'
real    0m0.504s
user    0m0.495s
sys     0m0.008s$var = $_GET['foo'];
bar($var);<?php 
$nameErr = $emailErr = $genderErr = "";
function checkDone()
{
    global $nameErr;
    if ($nameErr == "") {
        return "true";
    } else {
        return "false";
    }
}
echo checkDone();