File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / spl / tests / fileobject_001.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 6 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
SPL: SplFileObject::seek'ing
--FILE--
<?php

$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001a.txt');

var_dump($o->key());
var_dump($o->current());
$o->setFlags(SplFileObject::DROP_NEW_LINE);
var_dump($o->key());
var_dump($o->current());
var_dump($o->key());
$o->next();
var_dump($o->key());
var_dump($o->current());
var_dump($o->key());
$o->rewind();
var_dump($o->key());
var_dump($o->current());
var_dump($o->key());
$o->seek(4);
var_dump($o->key());
var_dump($o->current());
var_dump($o->key());

echo "===A===\n";
foreach($o as $n => $l)
{
	var_dump($n, $l);
}

echo "===B===\n";
$o = new SplFileObject(dirname(__FILE__) . '/fileobject_001b.txt');
$o->setFlags(SplFileObject::DROP_NEW_LINE);
foreach($o as $n => $l)
{
	var_dump($n, $l);
}

?>
===DONE===
--EXPECT--
int(0)
string(2) "0
"
int(0)
string(2) "0
"
int(0)
int(1)
string(1) "1"
int(1)
int(0)
string(1) "0"
int(0)
int(4)
string(1) "4"
int(4)
===A===
int(0)
string(1) "0"
int(1)
string(1) "1"
int(2)
string(1) "2"
int(3)
string(1) "3"
int(4)
string(1) "4"
int(5)
string(1) "5"
int(6)
string(0) ""
===B===
int(0)
string(1) "0"
int(1)
string(1) "1"
int(2)
string(1) "2"
int(3)
string(1) "3"
int(4)
string(1) "4"
int(5)
string(1) "5"
===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>