php - Function won't work with for loop -


so adding in buttons wysiwyg(tinymce) on wordpress. there's function called add buttons button array. inside function created new loop because there quite few buttons add. there must wrong loop because throws errors while inserting code manually returns none.

 //add button button array.  function register_button($buttons) { //use php 'array_push' function add columns button $buttons array         $columnnum = array('one','two','three','four','five','six','seven','eight','nine','ten','eleven');         for($i=0;$i<11;$i++){             array_push($buttons, '"'.$columnnum[$i].'_col"');            array_push($buttons, '"'.$columnnum[$i].'_col_first"');            array_push($buttons, '"'.$columnnum[$i].'_col_last"');        }   //return buttons array tinymce    return $buttons; }  

thanks help!

did check if $buttons array? because if not, array_push fail.

if sure $buttons array can try this:

$buttons[] = '"'.$columnnum[$i].'_col"'; 

by way: sure it should not $columnnum[$i].'_col' without double quotes?

anyway there obvius ways optimize code e.g.

for($i = 0; $i < count($columnum); $i++){ 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -