<?php 
 function BubbleSort($str) 
 { 
 for ($i=0;$i<count($str);$i++) 
 {     
     for ($j=count($str)-2;$j>=$i;$j--) 
      { 
             if($str[$j+1]<$str[$j]) 
              {    
                 $tmp = $str[$j+1]; 
                  
                 $str[$j+1]=$str[$j]; 
                 $str[$j]=$tmp; 
              } 
 
      } 
 
 } 
 return $str; 
 } 
 $str = array(3,6,1,5,9,0,4,6,11); 
 print_r(BubbleSort($str)); 
 ?>