Ozzapoo Posted March 15, 2008 Share Posted March 15, 2008 I was trying to make my own function using php, but then it screwed up because I had If..Then.. statements in my function... is it possible to have If..Then.. statements inside of user-defined functions??? ??? Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/ Share on other sites More sharing options...
fallenangel1983 Posted March 15, 2008 Share Posted March 15, 2008 I would probably use If statements with ifelse statements instead of ifthen probably less hassle with user defined functions Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/#findComment-493079 Share on other sites More sharing options...
Barand Posted March 15, 2008 Share Posted March 15, 2008 If ... Then isn't PHP syntax. Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/#findComment-493082 Share on other sites More sharing options...
wildteen88 Posted March 15, 2008 Share Posted March 15, 2008 There is no issues with using if/else statements in functions. You most probably have a syntax issue which is causing your function to fail. Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/#findComment-493083 Share on other sites More sharing options...
discomatt Posted March 15, 2008 Share Posted March 15, 2008 do it liek so: function newFunction($arg1, $arg2 = FALSE) { if ($arg2) { echo 'You entered ' . $arg2; $arg1 .= ' and $arg2 was'nt false.'; } echo '<br>' . $arg1; } Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/#findComment-493085 Share on other sites More sharing options...
Ozzapoo Posted March 16, 2008 Author Share Posted March 16, 2008 Thanks! I figured out the problem ;) ;) ;) ;) Link to comment https://forums.phpfreaks.com/topic/96328-problem-with-user-defined-function/#findComment-493142 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.