Ver Mensaje Individual
  #1 (permalink)  
Antiguo 26/11/2013, 09:56
Avatar de Linton
Linton
 
Fecha de Ingreso: diciembre-2011
Ubicación: Viena
Mensajes: 1.213
Antigüedad: 12 años, 4 meses
Puntos: 55
No funciona este programa de un manual

Sacado de Php & MySQL: The Missing Manual :

Código PHP:
Ver original
  1. <?php
  2.  
  3. echo "Hello there. So I hear you're learning to be a PHP programmer!\n";
  4. echo "Why don't you type in your name for me:\n";
  5. $name = trim(fgets(STDIN));
  6.  
  7. echo "\nThanks, " . $name . ", it's really nice to meet you.\n\n";
  8.  
  9. ?>

Se supone que pide el nombre del usuario y entrega un mensaje de bienvenida personalizado. Pues no, esto es lo que me aparece:
Hello there. So I hear you're learning to be a PHP programmer! Why don't you type in your name for me:
Notice: Use of undefined constant STDIN - assumed 'STDIN' in C:\xampp\htdocs\htdocs\php28\index.php on line 5

Warning: fgets() expects parameter 1 to be resource, string given in C:\xampp\htdocs\htdocs\php28\index.php on line 5
Thanks, , it's really nice to meet you.
¿Dónde está el fallo? Gracias, un saludo.