Created
October 5, 2022 21:53
-
-
Save trych/b96b8763e336039cef5f0f0d6d056a2b to your computer and use it in GitHub Desktop.
getkirby e() helper function that does not throw error on undefined variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function e(&$condition, $value, $alternative = null) { | |
echo $condition ? $value : $alternative; | |
} | |
$class = "banana"; | |
e($class, 'class="' . $class . '"'); | |
e($anotherClass, 'class="' . $anotherClass . '"'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment