|
SplFileObject::__constructConstruct a new file object. Beschreibung
public SplFileObject::__construct
( string
$filename
[, string $open_mode = "r"
[, bool $use_include_path = false
[, resource $context
]]] )Construct a new file object. Parameter-Liste
RückgabewerteEs wird kein Wert zurückgegeben. Fehler/Exceptions
Throws a RuntimeException if the Beispiele
Beispiel #1 SplFileObject::__construct example This example opens the current file and iterates over its contents line by line.
<?phpDas oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:
Line 0 is <?php
Line 1 is $file = new SplFileObject(__FILE__);
Line 2 is foreach ($file as $line_num => $line) {
Line 3 is echo "Line $line_num is $line";
Line 4 is }
Line 5 is ?>
Siehe auch
|