Last active
January 5, 2020 14:38
-
-
Save tlkshadow/6f214caddd8aec86c95136366005cf83 to your computer and use it in GitHub Desktop.
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 | |
$data = ['likes' => 'Laravel']; | |
$object = new stdClass(); | |
$object->name = 'Marcel'; | |
$object->city = 'Hamburg'; | |
if (property_exists($object, 'name')) { | |
echo $object->name; | |
} | |
echo ' from '; | |
if (property_exists($object, 'city')) { | |
echo $object->city; | |
} | |
echo ' likes '; | |
if (array_key_exists('likes', $data)) { | |
echo $data['likes']; | |
} | |
if (!empty($data['not'])) { | |
echo $data['not']; | |
} else { | |
echo '!'; | |
} | |
# Marcel from Hamburg likes Laravel! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment