Документация
HTML CSS PHP PERL другое

Section 4.2.  Empty Strings

 
Previous
Table of Contents
Next

4.2. Empty Strings

Don't use "" or '' for an empty string.

An important exception to the preceding rules is the empty string. You can't use "", as an empty string doesn't interpolate anything. It doesn't contain a literal quote or brace either, so the previous rules call for it to be written like so:

    $error_msg = '';

But that's not a good choice. In many display fonts, it's far too easy to mistake '' (single-quote, single-quote) for " (a lone double-quote), which means that you need to apply the second rule for non-interpolated strings, and write each empty string like so, preferably with a comment highlighting it:


    $error_msg = q{};  
# Empty string

Also see the "Constants" guideline later in this chapter.

    Previous
    Table of Contents
    Next
    © 2000- NIV