Bubble sort program printing zeros

Hi,
I have created the following bubble sort program, but its printing 20 zeros.

<?php
$arr = array(10, 20, 15, 17, 30, 50, 34, 46, 67, 55) ;
$array_size = count($arr);

for ($i=0; $i<$array_size; $i++) 
   echo "$arr[i]" + "<BR>"; 


for ($i=0; $i<$array_size; $i++) { 
   for ($j=0; $j<$array_size-1; $j++) { 
         if($arr[$j]<$arr[$j + 1]){ 
            $temp = $arr[$j];
            $arr[$j]  = $arr[$j + 1]; 
            $arr[$j + 1] = $temp; 
        } 
    } 
} 
for ($i=0; $i<$array_size; $i++) 
   echo "$arr[i]" + "<BR>"; 
?>

Somebody please guide me what is the problem with this code, why my array is not initialized?

Zulfi.

"$arr[i]" + "<BR>"
should be:
"$arr[$i]" . "<BR>"
(in two places)

1 Like