Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- SPL: SplFileObject::setCsvControl basic --CREDITS-- Erwin Poeze <erwin.poeze at g..
Decoded Output download
--TEST--
SPL: SplFileObject::setCsvControl basic
--CREDITS--
Erwin Poeze <erwin.poeze at gmail.com>
--FILE--
<?php
file_put_contents('csv_control_data_basic.csv',
<<<CDATA
'groene appelen'|10
'gele bananen'|20
'rode kersen'|30
CDATA
);
$s = new SplFileObject('csv_control_data_basic.csv');
$s->setFlags(SplFileObject::READ_CSV);
$s->setCsvControl('|', '\'', '/');
foreach ($s as $row) {
list($fruit, $quantity) = $row;
echo "$fruit : $quantity
";
}
?>
--CLEAN--
<?php
unlink('csv_control_data_basic.csv');
?>
--EXPECT--
groene appelen : 10
gele bananen : 20
rode kersen : 30
Did this file decode correctly?
Original Code
--TEST--
SPL: SplFileObject::setCsvControl basic
--CREDITS--
Erwin Poeze <erwin.poeze at gmail.com>
--FILE--
<?php
file_put_contents('csv_control_data_basic.csv',
<<<CDATA
'groene appelen'|10
'gele bananen'|20
'rode kersen'|30
CDATA
);
$s = new SplFileObject('csv_control_data_basic.csv');
$s->setFlags(SplFileObject::READ_CSV);
$s->setCsvControl('|', '\'', '/');
foreach ($s as $row) {
list($fruit, $quantity) = $row;
echo "$fruit : $quantity\n";
}
?>
--CLEAN--
<?php
unlink('csv_control_data_basic.csv');
?>
--EXPECT--
groene appelen : 10
gele bananen : 20
rode kersen : 30
Function Calls
file_put_contents | 1 |
Stats
MD5 | 2c7f3817841c8ecf7ffb24fbbdd867f0 |
Eval Count | 0 |
Decode Time | 90 ms |