lab5-1 - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of lab5-1.php
- <?php
- //Зададим функцию:
- function hello($name) { //укажем здесь параметр $name, в котором будет лежать имя человека
- //Введем переменную $text, в которую запишем всю фразу:
- $text = 'Привет, '.name.'!';
- /*
- Укажем функции с помощью инструкции 'return',
- что мы хотим, чтобы она ВЕРНУЛА содержимое переменной $text:
- */
- return $text;
- }
- //Теперь вызовем нашу функцию и запишем значение в переменную $message:
- $message = hello('Дима');
- //И теперь в переменной $text лежит 'Привет, Дима!':
- echo $message; //убедимся в этом
- //Поздороваемся сразу с группой людей из трех человек:
- echo hello('Вася'.' '.hello('Петя').' '.hello('Коля'));
- ?>
File Description
- lab5-1
- PHP Code
- 01 Dec-2022
- 1004 Bytes
You can Share it:
Latest PHP Pastes