Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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