Created
January 29, 2021 12:55
-
-
Save adamrosloniec/c3f49412db53f7255d4b126b8a025b71 to your computer and use it in GitHub Desktop.
PHP - Convert/Format string apostrophes at json_encode
This file contains hidden or 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
function formattedString($string) { | |
return str_replace([''', '"'], "'", filter_var($string, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment