7f4e3c39d6
This diff started off with trying to actually build `SplFileObject` since it was just stubbed out. But then I had to implement everything that extended from it since C++ classes can't extend PHP classes. And then it ballooend into what you see here. I actually think this is better in the long run, so that's why I kept going down this road. The only thing that doesn't work in pure PHP is `sscanf`. @mwilliams has a fix for that. We need variable args by reference. I implemented `RecursiveIteratorIterator` in a similar way to our C++ code instead of copying Zend. It translated to PHP a bit nicer. We still don't support the `RecursiveTreeIterator`, but I havn't come accross a need for that yet. I changed the implementation to actually use the `getChildren()` methods instead of peaking inside the `RecursiveDirectoryIterator`.
20 linhas
545 B
PHP
20 linhas
545 B
PHP
<?php
|
|
$fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv.csv', 'w');
|
|
|
|
echo "*** Testing error conditions ***\n";
|
|
// zero argument
|
|
echo "-- Testing fputcsv() with zero argument --\n";
|
|
var_dump( $fo->fputcsv() );
|
|
|
|
// more than expected no. of args
|
|
echo "-- Testing fputcsv() with more than expected number of arguments --\n";
|
|
$fields = array("fld1", "fld2");
|
|
$delim = ";";
|
|
$enclosure ="\"";
|
|
var_dump( $fo->fputcsv($fields, $delim, $enclosure, $fo) );
|
|
|
|
echo "Done\n";?>
|
|
<?php
|
|
$file = __DIR__ . '/SplFileObject_fputcsv.csv';
|
|
unlink($file);
|
|
?>
|