How to get arrays into phpchart

I am trying to create a chart with phpChart, that will show a value based on its date.
The data for the array is retrieved from a mySQL DB and put into a variable (eventually as $chrt).
If I echo the array they are showed right, but if I pass them on to the phpChart function, nothing happens. The chart stays empty.
However, if I copy and paste the very values of the **array ** into the phpChart function, the chart is show correctly.

Here is a snippet of the code:

 $db = mysqli_select_db($connection, "stockreport") or die("Error " . mysqli_error());
$item = $_GET["item"];
   $sql = mysqli_query($connection, "SELECT * FROM import2 where itemcode=$item");

   while($row = mysqli_fetch_array($sql)) {
   $stock[] = $row['stock'];
   $date[] = $row['impdate'];
   
   $data = strtotime($row[0]);
   $date2 = date('Y-m-d', $data);   
   
   $vals = 'array("' . $date2 . '",' . $row[3] . '),';    
   
   **$chrt** = array($vals);
    print_r($chrt);    
       
       }
    
     
    
$pc = new C_PhpChartX(array(**$chrt**),'chart1');

And here the array:

array(“2022-11-18”,250),array(“2022-11-21”,250),array(“2022-11-28”,250),array(“2022-12-05”,230),array(“2022-12-12”,226),array(“2022-12-19”,226),array(“2022-12-26”,226),array(“2023-01-02”,226),array(“2023-01-09”,226),array(“2023-01-16”,226),array(“2023-01-23”,172),array(“2023-01-30”,172),array(“2023-02-06”,127),array(“2023-02-13”,117),array(“2023-02-27”,117),array(“2023-03-06”,77),array(“2023-03-13”,72),array(“2023-03-20”,32),array(“2023-04-03”,12),array(“2023-04-10”,12),array(“2023-04-17”,12),array(“2023-04-24”,2),array(“2023-05-01”,2),array(“2023-05-08”,2),

I tried putting the data into a file with JSON, and get them back into the function, but it won’t also work.