I want to use active user in api

Hello all excuse me if I erred in writing the language, I weak in English language my request is that I want to Link between api User Name and I want to explain to you my point of view through the code

$m=0;

$ARRAY2 = $API->comm("/ip/hotspot/user/print");

$ARRAY3=$API->comm("/ip/hotspot/active/print");
$n=0;
while ($n<count($ARRAY2) ){
$regtable2 = $ARRAY2[$n];
$regtable2 = $ARRAY2[$m];

	echo '<tr id="v'.$regtable2['name'].'" align="center">';
 echo "<td>".$regtable2['name']."</td>";

if ($regtable2['name']==$regtable3['user']){
	
	echo "<td>online</td>";
	
}else{
	echo "<td>ofline</td>";
}
?>

This code does not work as good

thanks alot my problem is solved by me