1--TEST-- 2str_getcsv(): Testing using various arguments 3--FILE-- 4<?php 5 6// string input[, string delimiter[, string enclosure[, string escape]]] 7var_dump(str_getcsv('"f", "o", ""', escape: '')); 8print "-----\n"; 9var_dump(str_getcsv('foo||bar', '|', escape: '')); 10print "-----\n"; 11var_dump(str_getcsv('foo|bar', '|', escape: '')); 12print "-----\n"; 13var_dump(str_getcsv('|foo|-|bar|', '-', '|', escape: '')); 14print "-----\n"; 15var_dump(str_getcsv('|f.|.|bar|.|-|-.|', '.', '|', '-')); 16print "-----\n"; 17var_dump(str_getcsv('.foo..bar.', '.', '.', '.')); 18print "-----\n"; 19var_dump(str_getcsv('.foo . . bar .', ' ', '.', '')); 20print "-----\n"; 21var_dump(str_getcsv('" "" "', ' ', escape: '')); 22print "-----\n"; 23var_dump(str_getcsv('', escape: '')); 24print "-----\n"; 25 26?> 27--EXPECTF-- 28array(3) { 29 [0]=> 30 string(1) "f" 31 [1]=> 32 string(1) "o" 33 [2]=> 34 string(0) "" 35} 36----- 37array(3) { 38 [0]=> 39 string(3) "foo" 40 [1]=> 41 string(0) "" 42 [2]=> 43 string(3) "bar" 44} 45----- 46array(2) { 47 [0]=> 48 string(3) "foo" 49 [1]=> 50 string(3) "bar" 51} 52----- 53array(2) { 54 [0]=> 55 string(3) "foo" 56 [1]=> 57 string(3) "bar" 58} 59----- 60array(3) { 61 [0]=> 62 string(2) "f." 63 [1]=> 64 string(3) "bar" 65 [2]=> 66 string(4) "-|-." 67} 68----- 69array(1) { 70 [0]=> 71 string(7) "foo.bar" 72} 73----- 74array(2) { 75 [0]=> 76 string(5) "foo " 77 [1]=> 78 string(7) " bar " 79} 80----- 81array(1) { 82 [0]=> 83 string(3) " " " 84} 85----- 86array(1) { 87 [0]=> 88 NULL 89} 90----- 91