Problem with PHP 7 latest version

I use preg_match function in my codes. It could work properly, but after I updated PHP latest version. It can not work anymore.

example: preg_match( "/^\/([A-Z0-9]+) (.*)$/i", text, matches )

When I echo matches[ 2 ]. It shows PHP Notice: Cannot use a scalar value as an array

When I use var_dump( matches ). It can show array datas &array{ 0=>... 1=>... 2=>... }

When I use count( matches ). It show only 1.

Thank you and Happy New Year.

let matches = null;
preg_match("/[a-z]/", "string", matches);