Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save buiquangduc/6747a33170e80118a6ad7464fa0ad8b7 to your computer and use it in GitHub Desktop.
Save buiquangduc/6747a33170e80118a6ad7464fa0ad8b7 to your computer and use it in GitHub Desktop.
Routine improve performance
<?php
// When place the code in a routine, you can easily optimize the code
// Example:
// You can optimize the code inside the routine below
function isTooLong($string) {
if(strlen($string) > 20) {
return true;
} else {
return false;
}
}
// With
function isTooLong($string) {
return strlen($string) > 20 ? return true : return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment