Ver Mensaje Individual
  #6 (permalink)  
Antiguo 07/02/2014, 17:23
quico5
 
Fecha de Ingreso: enero-2008
Mensajes: 580
Antigüedad: 16 años, 4 meses
Puntos: 9
Respuesta: No me carga un array dentro de una función

no comprendo bien el fallo que comentas, ¿puedes concretar? gracias
Cita:
no es buena idea usar variables por referencia
http://www.php.net/manual/es/languag...ences.pass.php




Código PHP:
<?php

    
function lista() {
        return array (
            array(
'Autobiografía','GJ0bMSr5-P0'),
            array(
'Quedate','DXQnHbg8kS4'),
            array(
'Catro_vellos_marineiros_con_David_Civera','nlIVrm3frrE'),
            array(
'Oh_sole_mio','0ZTiWAtB42c'),
        );
    }
    
$videos=lista();

    function 
title(&$title) {
        
$title=str_replace("_"," ",$title);
        
$title=str_replace("marineiros","mariñeiros",$title);        
    }    
    function 
enlace(&$video) {
        
$url=strtolower($video);
        
$title=$video;
        
title($title);
        print 
"<a href=\"$url.html\">$title</a>";
    }
    foreach (
$videos as $clave=>$valor) {
        if (isset(
$_GET["v"])) {
            if (
strtolower($valor[0])==strtolower($_GET["v"])) {
                
$title=$valor[0];
                
title($title);
                
$url=$valor[1];
            }
        } else {
                
$title="Autobiografía";
                
$url=$videos[0][1];
        }
        
$server="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
?>