OM2 Posted April 26, 2008 Share Posted April 26, 2008 I need some coding advice. I have the following code: <?php editText(7); ?> <?php echo $vars["field-7"]; ?> I have several calls similar to the above - the only variable being the number. What I really want is something like this: <?php myFunction(7) ?> But: how do I declare myFunction()...?? myFunction(), when called should have the same effect as having the first code sample above. I've would have tried bit of research: but am not sure what to read up on! Thanks. OM Link to comment https://forums.phpfreaks.com/topic/103011-need-coding-advice/ Share on other sites More sharing options...
Daniel0 Posted April 26, 2008 Share Posted April 26, 2008 function myFunction($num) { editText($num); echo $vars["field-{$num}"]; } ? Link to comment https://forums.phpfreaks.com/topic/103011-need-coding-advice/#findComment-527676 Share on other sites More sharing options...
OM2 Posted April 26, 2008 Author Share Posted April 26, 2008 thank u thank u thank u! i'm sure u can tell i'm a php newbie: i never new about the use of the {}. Link to comment https://forums.phpfreaks.com/topic/103011-need-coding-advice/#findComment-527683 Share on other sites More sharing options...
Daniel0 Posted April 26, 2008 Share Posted April 26, 2008 You might want to read the language reference section of the manual: http://www.php.net/manual/en/langref.php Link to comment https://forums.phpfreaks.com/topic/103011-need-coding-advice/#findComment-527688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.