Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## 10
- $subject = 'answer';
- $string = 'The $subject is'.(74+3); echo "1 $string<br>";
- $string = "The ${subject} is".'77'; echo "2 $string";
- //$string = "The $subject is".(74+3); Тут ошибка потому что (74+3) не переменные но канкатенированы точкой
- $string = "The {$subject} is ${78-1}"; echo "3 $string"; // тут ошибки нет, но такую переменную он не увидит (она без имени)
- // $string = 'The '.$subject.' is '.74+3; Ошибка в конце где .74 тут 74 это не переменная
- // Ответ: 1 и 2 варианты верные
- ## 11
- $a = 1;
- function test(){
- global $a;
- echo "a = ${a+1}";
- }
- test();
- // Выведет а = (Ответ 4)
- ## 12
- function getQuotient($a, $b){
- return (int)($a / $b);
- }
- echo getQuotient(13,5);
- // Выведет 2 (Ответ №2)
- ## 21
- $a = array(
- null => 'a',
- true+false => 'b',
- false-true => 'c',
- 0+1 => 'd',
- 1-1 => 'e',
- '0' => 'f',
- );
- echo count($a); // Выведет 4 (Ответ 4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement