Variabel Sebelum Pemanggilan Fungsi Anonim di PHP

Misalkan kita memiliki kode berikut:

php<?php
  $pow = 2;
  
  $func = function($num) use ($pow)
  {
    return $num ** $pow;
  };
  
  echo $func(4);
?>

Kode di atas bekerja, karena variabel $pow ditulis sebelum deklarasi fungsi. Namun, jika kita menempatkan deklarasi variabel sebelum pemanggilan fungsi, segala sesuatu akan berhenti bekerja:

php<?php
  $func = function($num) use ($pow)
  {
    return $num ** $pow;
  };
  
  $pow = 2;
  echo $func(4);
?>

Masalah dapat diperbaiki, jika variabel dilewatkan oleh referensi:

php<?php
  $func = function($num) use (&$pow)
  {
    return $num ** $pow;
  };
  
  $pow = 2;
  echo $func(4);
?>
Задание 1

Perbaiki kode agar dapat bekerja seperti yang dimaksud:

php<?php
  $func = function() use ($num1, $num2)
  {
    return $num1 + $num2;
  };
  
  $num1 = 2;
  $num2 = 3;
  echo $func();
?>