Advertisement
zero50x

Сертификация

Apr 13th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. ## 10
  2. $subject = 'answer';
  3. $string = 'The $subject is'.(74+3); echo "1 $string<br>";
  4. $string = "The ${subject} is".'77'; echo "2 $string";
  5. //$string = "The $subject is".(74+3); Тут ошибка потому что (74+3) не переменные но канкатенированы точкой
  6. $string = "The {$subject} is ${78-1}"; echo "3 $string"; // тут ошибки нет, но такую переменную он не увидит (она без имени)
  7. // $string = 'The '.$subject.' is '.74+3; Ошибка в конце где .74 тут 74 это не переменная
  8. // Ответ: 1 и 2 варианты верные
  9.  
  10.  
  11. ## 11
  12. $a = 1;
  13. function test(){
  14.     global $a;
  15.     echo "a = ${a+1}";
  16. }
  17. test();
  18. // Выведет а = (Ответ 4)
  19.  
  20.  
  21. ## 12
  22. function getQuotient($a, $b){
  23.     return (int)($a / $b);
  24. }
  25. echo getQuotient(13,5);
  26. // Выведет 2 (Ответ №2)
  27.  
  28.  
  29. ## 21
  30. $a = array(
  31. null => 'a',
  32. true+false => 'b',
  33. false-true => 'c',
  34. 0+1 => 'd',
  35. 1-1 => 'e',
  36. '0' => 'f',
  37. );
  38. echo count($a); // Выведет 4 (Ответ 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement