[PHP-NOTES] note 130234 added to language.types.string

[email protected] ("[email protected]")
Newsgroups php.notes
Message-ID <[email protected]>
<?php
function doubleQuote($str) {
    $ret = '"';
    for ($i = 0, $l = strlen($str); $i < $l; ++$i) {
        $o = ord($str[$i]);
        if ($o < 31 || $o > 126) {
            switch ($o) {
                case 9: $ret .= '\t'; break;
                case 10: $ret .= '\n'; break;
                case 11: $ret .= '\v'; break;
                case 12: $ret .= '\f'; break;
                case 13: $ret .= '\r'; break;
                default: $ret .= '\x' . str_pad(dechex($o), 2, '0', STR_PAD_LEFT);
            }
        } else {
            switch ($o) {
                case 36: $ret .= '\$'; break;
                case 34: $ret .= '\"'; break;
                case 92: $ret .= '\\\\'; break;
                default: $ret .= $str[$i];
            }
        }
    }
    return $ret . '"';
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 103.49.146.86)
----
Manual Page -- https://php.net/manual/en/language.types.string.php
Edit        -- https://main.php.net/note/edit/130234
Del: integrated  -- https://main.php.net/note/delete/130234/integrated
Del: useless     -- https://main.php.net/note/delete/130234/useless
Del: bad code    -- https://main.php.net/note/delete/130234/bad+code
Del: spam        -- https://main.php.net/note/delete/130234/spam
Del: non-english -- https://main.php.net/note/delete/130234/non-english
Del: in docs     -- https://main.php.net/note/delete/130234/in+docs
Del: other reasons-- https://main.php.net/note/delete/130234
Reject      -- https://main.php.net/note/reject/130234
Search      -- https://main.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.