How to put the value written on the face to the outside for use?

suppose I generate a value on some if faces

 $name 

if(xxx==xxx){
    if(xxx==xxx){
        if(xxx==xxx){
            $name = xxx;
        }
    }
}

I want to add $name to the outside of if to use
so what should I do?!

Mar.02,2021
Can't

$name be set as a global variable


var $name;
if(xxx==xxx){
  if(xxx==xxx){
      if(xxx==xxx){
          $name = xxx;
      }
  }
}

I don't quite understand what it means, but I should be able to write it this way:

<?php
function test() {
    global $teee;
    $teee = 1;
}
test();
echo $teee;
Menu