-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add str_getcsv builtin support (#1096)
Signed-off-by: Petr Shumilov <[email protected]>
- Loading branch information
1 parent
b30b495
commit 6198e0d
Showing
7 changed files
with
127 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@ok | ||
<?php | ||
|
||
$s1 = <<<_STR | ||
"a","b","c" | ||
_STR; | ||
|
||
$s2 = <<<_STR | ||
*a*,*b*,*\*c* | ||
_STR; | ||
|
||
|
||
// In php empty delimiter and enclosure args leads to the same behavior as omitted args | ||
var_dump(str_getcsv($s1)); | ||
var_dump(str_getcsv($s1, "")); | ||
|
||
var_dump(str_getcsv($s1, ",")); | ||
var_dump(str_getcsv($s1, ",", "")); | ||
|
||
// But empty escape symbol has same semantics as one backslash ("\") | ||
// 1 <=> 2 | ||
// not 1 <=> 3 | ||
var_dump(str_getcsv($s2, ",", "*")); // 1 | ||
var_dump(str_getcsv($s2, ",", "*", "\\")); // 2 | ||
var_dump(str_getcsv($s2, ",", "*", "")); // 3 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters