downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SplFileObject::eof> <SplFileObject::__construct
[edit] Last updated: Fri, 17 May 2013

view this page in

SplFileObject::current

(PHP 5 >= 5.1.0)

SplFileObject::currentRecupera la línea actual del fichero

Descripción

public string|array SplFileObject::current ( void )

Recupera la línea actual del fichero.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

Recupera la línea actual del fichero. Si la flag SplFileObject::READ_CSV está establecida, este método devuelve un array conteniendo la línea actual analizada como datos CSV.

Ejemplos

Ejemplo #1 Ejemplo de SplFileObject::current()

<?php
$fichero 
= new SplFileObject(__FILE__);
foreach (
$fichero as $k => $linea) {
   echo (
$fichero->key() + 1) . ': ' $fichero->current();
}
?>

El resultado del ejemplo sería algo similar a:

1: <?php
2: $fichero = new SplFileObject(__FILE__);
3: foreach ($fichero as $linea) {
4:     echo ($fichero->key() + 1) . ': ' . $fichero->current();
5: }
6: ?>

Ver también



add a note add a note User Contributed Notes SplFileObject::current - [0 notes]
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites