PHP variables are scoped to wherever they're declared, and PHP passes by value rather than by reference by default. What this means is that when you pass the array into the function, PHP creates a clone of the array and any changes you make to it happen on the
clone, not on the original value. You can change this by using
PHP Pass by Reference: The & Ampersand | PHP Reference Book Blog[
^]
Simply change your function declaration to include an ampersand (
&
) before the variable:
function imprimir_ocorrencias(&$lista_ocorrencia) {