Php to show array of $errors in javascript alert box

     

does anyone know how to return error array in a javascript alert box? The code below that I have doesn't do the trick right. Browser returns "Cannot use [] for reading". When using $error without the bracket browser only returns the word "Array" in the alert box but the error message is not showing. Any help?


echo '';  

Updated to include the extent of my code:


$errors = [];   $target_dirRFP = ('accounts/' . $order_list . '/rfp/');   $file_nameRFP = $_FILES['FileToUploadRFP']['name'];   $file_sizeRFP = $_FILES['FileToUploadRFP']['size'];   $extentionRFP = pathinfo($file_nameRFP PATHINFO_EXTENSION);   $tempRFP = ($_FILES["FileToUploadRFP"]["tmp_name"]);   $target_fileRFP = ($target_dirRFP . $file_nameRFP);   $valid_formatsRFP = array("pdf");
$target_dirPSA = ('accounts/' . $order_list . '/psa/');   $file_namePSA = $_FILES['FileToUploadPSA']['name'];   $file_sizePSA = $_FILES['FileToUploadPSA']['size'];   $extentionPSA = pathinfo($file_namePSA