May I first ask why you chose that client?*
Using my client (see my signature), you can do it like that (and if you do measurements, you'll also see it's a lot more efficient):
<?php
namespace PEAR2\Net\RouterOS;
require_once 'PEAR2_Net_RouterOS-1.0.0b3.phar';
$client = new Client('192.168.0.1', 'admin', 'password');
$responses = $client->sendSync(
new Request('/ip/firewall/address-list/print .proplist=.id', Query::where('list', 'mylist'))
)->getAllOfType(Response::TYPE_DATA);
$idList = '';
foreach ($responses as $response) {
$idList .= $response->getArgument('.id') . ',';
}
if ('' !== $idList) {
$removeRequest = new Request('/ip/firewall/address-list/remove');
$removeRequest->setArgument('numbers', rtrim($idList, ','));
$client->sendSync($removeRequest);
}
It's the same idea with Denis' client.
(the code above can be shortened further - especially if you have PHP 5.4 - but I'm keeping it verbose for clarity's sake)
* No. Honestly... I'm not criticizing or anything, I'm genuinely curious. Every time I ask this question, people either insist on using Denis' class without giving a reason or switch to my client without saying why they previously used the other one, leaving me to wonder what I'm doing wrong in terms of "PR", even if "technically" it's all good.