store array values in another array using for loop in php
$sql = "select id,user_email,username,full_name from registration";
$connection = Yii::app()->db;
$command = $connection->createCommand($sql);
$rows = $command->queryAll();
$email_arr = [];
for ($i=0; $i <=count($rows); $i++) {
$email_arr[] = $rows[$i]['user_email'];
}
i am getting undefined offset 39 php error anyone can help me please
$i <=count($rows), it should be just< (less than)that's because the indexing start from zero, which meanse the 39th element is with index 38.