jimfog Posted July 24, 2012 Share Posted July 24, 2012 I am trying to put a function as an argument of another function bit the IDE(Netbeans) highlights it as an error-I cannot understand why. Here is the code: function output_header($admin=false,output_header_list()) { ?><div id="header"> <div><a href="http://localhost/Appointments/Administrator/"><img src="Images/logo.png" width="307" height="32" /></a></div> </div><?php What can be wrong here? output_header_list is the function I am trying to use as an argument. Link to comment Share on other sites More sharing options...
Ingolme Posted July 24, 2012 Share Posted July 24, 2012 That syntax is invalid. You can pass the return value of a function to the function when calling it, but you can use it in the function declaration. Optional parameters have to go at the end of the parameter list. This would be valid: // Function declarationfunction output_header($header_list, $admin=false) { // ...}// Function calloutput_header(output_header_list(), false); Link to comment Share on other sites More sharing options...
jimfog Posted July 24, 2012 Author Share Posted July 24, 2012 I fixed it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.