Skip to main content
Active reading [<https://www.youtube.com/watch?v=1Dax90QyXgI&t=0m38s>]. Word order. Loosened up. Used more standard formatting.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

I use all timemy own useful function, exst(), all time which automatically declaredeclares variables.

Your code will be -

$greeting = "Hello, " . exst($user_name, 'Visitor') . " from " . exst($user_location); /**  * Function exst() - Checks if the variable has been set  * (copy/paste it in any place of your code) *  * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default *  * @return mixed  */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var)  || !$var ) { if (isset($default) && $default != "")  $t = $default; } else {  $t = $var; } if (is_string($t))  $t = trim($t); return $t; } 

I use all time own useful function exst() which automatically declare variables.

Your code will be -

$greeting = "Hello, ".exst($user_name, 'Visitor')." from ".exst($user_location); /**  * Function exst() - Checks if the variable has been set  * (copy/paste it in any place of your code) *  * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default *  * @return mixed  */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var)  || !$var ) { if (isset($default) && $default != "") $t = $default; } else {  $t = $var; } if (is_string($t)) $t = trim($t); return $t; } 

I use my own useful function, exst(), all time which automatically declares variables.

Your code will be -

$greeting = "Hello, " . exst($user_name, 'Visitor') . " from " . exst($user_location); /** * Function exst() - Checks if the variable has been set * (copy/paste it in any place of your code) * * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default * * @return mixed */ function exst(& $var, $default = "") { $t = ""; if (!isset($var) || !$var) { if (isset($default) && $default != "")  $t = $default; } else { $t = $var; } if (is_string($t))  $t = trim($t); return $t; } 
added 11 characters in body
Source Link

I use all time own useful function exst() which automatically declare variables.

Your code will be -

$greeting = "Hello, ".exst($user_name, 'Visitor')." from ".exst($user_location); /** * Function exst() - Checks if the variable has been set * (copy/paste it in any place of your code) * * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default * * @return mixed */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var) || !$var ) { if (isset($default) && $default != "") $t = $default; } else { $t = $var; } if (is_string($t)) $t = trim($t); return $t; } 

I use all time own useful function exst() which automatically declare variables.

Your code will be -

$greeting = "Hello, ".exst($user_name)." from ".exst($user_location); /** * Function exst() - Checks if the variable has been set * (copy/paste it in any place of your code) * * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default * * @return mixed */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var) || !$var ) { if (isset($default) && $default != "") $t = $default; } else { $t = $var; } if (is_string($t)) $t = trim($t); return $t; } 

I use all time own useful function exst() which automatically declare variables.

Your code will be -

$greeting = "Hello, ".exst($user_name, 'Visitor')." from ".exst($user_location); /** * Function exst() - Checks if the variable has been set * (copy/paste it in any place of your code) * * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default * * @return mixed */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var) || !$var ) { if (isset($default) && $default != "") $t = $default; } else { $t = $var; } if (is_string($t)) $t = trim($t); return $t; } 
Source Link

I use all time own useful function exst() which automatically declare variables.

Your code will be -

$greeting = "Hello, ".exst($user_name)." from ".exst($user_location); /** * Function exst() - Checks if the variable has been set * (copy/paste it in any place of your code) * * If the variable is set and not empty returns the variable (no transformation) * If the variable is not set or empty, returns the $default value * * @param mixed $var * @param mixed $default * * @return mixed */ function exst( & $var, $default = "") { $t = ""; if ( !isset($var) || !$var ) { if (isset($default) && $default != "") $t = $default; } else { $t = $var; } if (is_string($t)) $t = trim($t); return $t; } 
Post Made Community Wiki by user2253362