Skip to content

Instantly share code, notes, and snippets.

@lastday154
Created March 29, 2018 03:33
Show Gist options
  • Select an option

  • Save lastday154/09b51ec113c071fd7e3b8448ab06f004 to your computer and use it in GitHub Desktop.

Select an option

Save lastday154/09b51ec113c071fd7e3b8448ab06f004 to your computer and use it in GitHub Desktop.
isset vs in_array
<?php
$fields = ['id', 'availability', 'condition', 'description', 'image_link', 'link', 'title', 'price', 'currency'];
var_dump(isset($fields['id']));
var_dump(isset($fields[0]));
var_dump(in_array('id', $fields));
bool(false)
bool(true)
bool(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment