Simple bubble sort on PHP

“Bubble Sort” is a classic sort. It used ~76% of programmers.
Example ↓

function bubbleSort ($data_array = array() ) {
$result_array = $data_array;
$size = sizeof($result_array);
if ($size)
  for( $i = 0 ; $i < $size; $i++) {      
    for( $j = $size-1; $j > $i; $j-- ) { 
      if ( $result_array[$j-1] > $result_array[$j] ) {
            $buf = $result_array[$j-1]; 
            $result_array[$j-1] = $result_array[$j]; 
            $result_array[$j] = $buf;
		}
	}
  }
return $result_array;
}
 
$test_array = array(1, 9, 5, 2, 4, 5, 7, 0, 3, 8, 6); 
$result = bubbleSort ($test_array);
echo '<pre>'; print_R($result); echo '</pre>';

Results ↓

Array
(
    [0] => 0
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 4
    [5] => 5
    [6] => 5
    [7] => 6
    [8] => 7
    [9] => 8
    [10] => 9
)

Also, often encountered such version of realisation ↓

function bubbleSort( $data_array = array() )
{
$result_array = $data_array;
$size = sizeof($result_array);
if ($size)
do
	{
		$swapped = false;
		for( $i = 0; $i < $size - 1; $i++ )
		{
			if( $result_array[$i] > $result_array[$i + 1] )
			{
				list( $result_array[$i + 1], $result_array[$i] ) =
						array( $result_array[$i], $result_array[$i + 1] );
				$swapped = true;
			}
		}
	}
	while( $swapped );
return $result_array;
}

$test_array = array(1, 9, 5, 2, 4, 5, 7, 0, 3, 8, 6); 
$result = bubbleSort ($test_array);
echo '<pre>'; print_R($result); echo '</pre>';