fork download
  1. <?php
  2. //твой код выглядит как-то так:
  3. function sosay_kudosay($hueta_na_vhod) {
  4. $hueta_na_vihod = $hueta_na_vhod +1;
  5. }
  6. echo $hueta_na_vihod;
  7. //это эрор и неправильно
  8. //нельзя просто взять и обратиться к тому что внутри функции
  9.  
  10. //вот как это должно выглядеть
  11.  
  12. function niceFunction($input) {
  13. $output = $input + 1;
  14. return $output;
  15. }
  16.  
  17. $someVar = 1;
  18.  
  19. //вызываем фукцию, передаем ей что-то, и что-то от неё получаем, складывая в переменную
  20. $functionResult = niceFunction($someVar);
  21. //теперь можно посмотреть что нам вернула функция
  22. echo $functionResult;
  23.  
Success #stdin #stdout #stderr 0.01s 52488KB
stdin
Standard input is empty
stdout
2
stderr
PHP Notice:  Undefined variable: hueta_na_vihod in /home/ymtLpr/prog.php on line 6