Skip to content

Instantly share code, notes, and snippets.

@ftkro
Last active February 20, 2017 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ftkro/731e0c017345ecc73643d1dd5b78a110 to your computer and use it in GitHub Desktop.
Save ftkro/731e0c017345ecc73643d1dd5b78a110 to your computer and use it in GitHub Desktop.
汚いコードだなぁ…
<?php
//Eval is Evil so 汚ねぇコードだなぁ…
function Execute($function,...$data) {
if(count($data) == 0) {
$function($data[0]);
}
if(count($data) == 1) {
$function($data[0],$data[1]);
}
if(count($data) == 2) {
$function($data[0],$data[1],$data[2]);
}
if(count($data) == 3) {
$function($data[0],$data[1],$data[2],$data[3]);
}
if(count($data) == 4) {
$function($data[0],$data[1],$data[2],$data[3],$data[4]);
}
if(count($data) == 5) {
$function($data[0],$data[1],$data[2],$data[3],$data[4],$data[5]);
}
if(count($data) == 6) {
$function($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6]);
}
if(count($data) == 7) {
$function($data[0],$data[1],$data[2],$data[3],$data[4],$data[5],$data[6],$data[7]);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment