function - Number of variables depends of last variable (5 Variables when last is false, 7 when last is true) -


i trying function can take different variables depends of last one. should work this:

$photo = new photo('slide', 'upload', 1000, 460, false);  function __construct ($nazwa, $katalog, $szerokosc, $wysokosc, $miniaturka) 

and if last 1 true want 2 variables:

$photo = new photo('slide', 'upload', 1000, 460, true, 500, 230);  function __construct ($nazwa, $katalog, $szerokosc, $wysokosc, $miniaturka, $szerokosc_min, $wysokosc_min) 

why don't use constuct takes 7 variables 2 optional.

function __construct ($nazwa, $katalog, $szerokosc, $wysokosc, $miniaturka, $szerokosc_min=0, $wysokosc_min"0){      if $miniaturka == true{       //take value of last 2 variables      } } 

Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -