Global variable modification on switch / case in PHP

one text

Im new for php, I would like to know how can I update global variables for each method that Im invoking:

(pay attention to the global $text1 variable pls, specially from this line--> $this->welcome($to, false); :

In the method welcome I try update the global $text1 variable in this way :

$GLOBALS['text1'] = "lorum ipsum";  

I would like to use the new value of $text1 ("lorum ipsum") on the switch case 1 :

case '1': { 
    $this->client->sendChatMessage($to, date('d.m.Y H:i:s'). "valor de val". $GLOBALS['text1'] ); 
    break;
} 

but, It is always return empty.

Can you please advise me how can get the modified value of $text1 in the switch / statement case 1?

Thanks

class ultraMsgChatBot
{
    var $client;
    var $text1 ;
    var $randMsg;

    public function __construct($ultramsg_token, $instance_id)
    {
        global $license;
        global $randMsg;      
        global $text1 ;

        require_once('ultra.class.php'); 
        
        require_once('ultra-dictionary.php');

        $ultramsgDictionary = new ultramsgDictionary();
        $this->client = new UltraMsg\WhatsAppApi($ultramsg_token, $instance_id);
   
        ////////  Processing incoming messages
        if (isset($decoded['data'])) {
            $message = $decoded['data'];
            $text = $this->convert($message['body']);

            
            if (!$message['fromMe']) {
                $to = $message['from'];
                $val = mb_strtolower($text, 'UTF-8');
                switch ($val) {
                    case in_array($val, $ultramsgDictionary->welcomeIntent()): {
                        $randMsg = $ultramsgDictionary->welcomeResponses();
                      
                        $this->welcome($to, false);
                  
                        break;
                    }
                    
                    case '1': {
                        $this->client->sendChatMessage($to, date('d.m.Y H:i:s'). "valor de val". $GLOBALS['text1'] );
  
                        break;
                    }
                }

                public function welcome($to, $noWelcome = false)
                {
                    $welcomeStr = "hola"
                    $this->client->sendChatMessage(
                        $to,
                        $welcomeStr 
                    );
      
                    $GLOBALS['text1'] = "lorum ipsum";  
                }

            } 

Source