Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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
You can’t perform that action at this time.