Trying to wrap my head around this
function any_name($div,$width = false){
if($width){
$add_style =' style="width:1000px;"';
}else{
$add_style ='';
}
html ='<div id="'.$div.'"'.$add_style.'>';
html .= "</div>';
}
any_name('div1');// should print <div id="div1"></div>
any_name('div2',$width = true);// should print <div id="div2" style="width:1000px;"></div>
second function call prints
1
<div id="div2"></div>
What am I doing wrong ?
Any help is appreciated thank you!
! fund the real issue , my function has 2 more arguments
function ( $div,arg2,arg3,$width) the $width was in wrong place thus was resulting in 1
sorry for the confusion
1 Answer