Skip to content

Instantly share code, notes, and snippets.

View paamayim's full-sized avatar

Joshua M paamayim

  • Paamayim Nekudotayim
  • Tylertown, MS
View GitHub Profile
@paamayim
paamayim / expect.fn.php
Last active March 2, 2016 00:06
PHP array argument validation: Checks that required variables exist within a scope
<?php
/**
* Checks that required variables exist within a scope(array or object)
* If any required variable is not present, an exception is thrown.
* Also allows an input of default variables, which are set if not set beforehand
*
* Example usage:
* function foo($args){
* expect($args, ['a', 'b', 'c']); // throws error