Quoting Strings 
Strings should be quoted with single quotes if they contain no variables or control characters, otherwise use double quotes.
$flat_string = 'Hello, this is a string';

$dynamic_one = "Hello,\nthis is a string.";

$dynamic_two = "Hello $username,\n this is a string.";
The choice between using string evaluations or string additions is yours to make, depending upon the circumstances.
$string_one = "The time is $timenow and the date is $datenow.";

$string_two = 'The time is ' . time() . ' and the date is ' . $datenow . '.';
SQL Queries should always be double-quoted.
$results = $DB_site->query("SELECT field FROM " . TABLE_PREFIX . "table AS table");
Variables should not be quoted if they do not need to be.
$var = "$x";

$result = strtoupper("$string");

$var = $x;

$result = strtoupper($string);

$string = fetch_something("something$var");
Eval() calls should be single-quoted if possible, to avoid unncessary character escaping.
eval("\$template = \"" . fetch_template('template') . "\";");

eval('$template = "' . fetch_template('template') . '";');
Copyright © 2024 MH Sub I, LLC dba vBulletin. All rights reserved. vBulletin® is a registered trademark of MH Sub I, LLC dba vBulletin.