Php Mongo how to pass a variable to a cursor

I am unfamiliar with the syntax to pass a variable to a mongo cursor. Currently I have the ‘name’ hardcoded as ‘ABC’. But I want to be able to pass a variable instead of hardcoding ‘ABC’.

$client = new MongoDB\Client(“mongodb://localhost”);
$dbs = $client ->database_name->table_name; // $client → DBNAME → COLLECTION_NAME
$result = $dbs → find(array(‘name’ => ‘ABC’));

I tried this, but it is not working.

$name = ‘ABC’;
$result = $dbs → find(array(‘name’ => $name));

Can someone please provide me with the correct syntax? Thanks