Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 17, 2021
Embed
What would you like to do?
<?php
function burbuja(&$arreglo)
{
$longitud = count($arreglo);
for ($i = 0; $i < $longitud; $i++) {
for ($j = 0; $j < $longitud - 1; $j++) {
if ($arreglo[$j] > $arreglo[$j + 1]) {
$temporal = $arreglo[$j];
$arreglo[$j] = $arreglo[$j + 1];
$arreglo[$j + 1] = $temporal;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment