SplFileObject_fputcsv_002.phpt 641 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. SplFileObject::fputcsv(): Checking data after calling the function
  3. --FILE--
  4. <?php
  5. $fo = new SplFileObject(__DIR__ . '/SplFileObject_fputcsv1.csv', 'w');
  6. $data = array(1, 2, 'foo', 'haha', array(4, 5, 6), 1.3, null);
  7. $fo->fputcsv($data);
  8. var_dump($data);
  9. ?>
  10. --CLEAN--
  11. <?php
  12. $file = __DIR__ . '/SplFileObject_fputcsv1.csv';
  13. unlink($file);
  14. ?>
  15. --EXPECTF--
  16. Warning: Array to string conversion in %s on line %d
  17. array(7) {
  18. [0]=>
  19. int(1)
  20. [1]=>
  21. int(2)
  22. [2]=>
  23. string(3) "foo"
  24. [3]=>
  25. string(4) "haha"
  26. [4]=>
  27. array(3) {
  28. [0]=>
  29. int(4)
  30. [1]=>
  31. int(5)
  32. [2]=>
  33. int(6)
  34. }
  35. [5]=>
  36. float(1.3)
  37. [6]=>
  38. NULL
  39. }