Ver Mensaje Individual
  #6 (permalink)  
Antiguo 28/09/2005, 14:09
Avatar de Vaalegk
Vaalegk
 
Fecha de Ingreso: abril-2005
Mensajes: 154
Antigüedad: 19 años
Puntos: 2
No sale en pantalla, que raro a mi me funciona bien...
bueno aqui hay mas ejemplos varios.

Código PHP:
//con variables
$res1=1;
$res2=5;
$res3=80;

for (
$i=1$i <= 3$i++) {
   echo ${
'res'.$i}."<br />\n";
}


$varname='res';
echo(
'<hr />');
for (
$i=1$i <= 3$i++) {
   echo ${
$varname.$i}."<br />\n";


//llamando funciones
function hola($msg){
    echo(
'hola '.$msg);
}

$func='hola';
$func('Test');

echo(
'<hr />');

// con clases

class test{
    var 
$data;
    function 
__construct($d){
        
$this->data=$d;
    }
    function 
ver(){
        echo(
$this->data.'<br />');        
    }
}

$t1=new test(1);
$t2=new test(2);
$t3=new test(3);

for (
$i=1$i <= 3$i++){
    echo ${
't'.$i}->ver();