Created
March 14, 2018 01:57
-
-
Save benpearson/f25f1d920930cd508f0b311a2fae6246 to your computer and use it in GitHub Desktop.
PHP ternary operator formatting
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 | |
$image_url = get_the_post_thumbnail_url( $post->ID, 'full' ) ?: 'http://via.placeholder.com/993x556' | |
$image_url = get_the_post_thumbnail_url( $post->ID, 'full' ) | |
? 'value if true' | |
: 'value if false'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment