Internal Function Variables in PHP

Variables declared inside a function are not visible outside. Let's look at an example. Suppose we have the following variable:

php<?php
  function func()
  {
    $num = 1;
  }
?>

Let's try to output the variable $num from outside the function:

php<?php
  function func()
  {
    $num = 1;
  }
  
  func();
  echo $num; // error
?>
Задание 1

Explain what the result of the code execution will be:

php<?php
  function func()
  {
    $aaa = '!!!';
  }
  
  func();
  echo $aaa;
?>
Задание 2

Explain what the result of the code execution will be:

php<?php
  function func($aaa)
  {
    $aaa = 222;
  }
  
  func(111);
  echo $aaa;
?>