garyblackpool Posted September 25, 2009 Report Share Posted September 25, 2009 (edited) Hi this is probably yet another silly question but why is this only returning default <?print verse($bodypart);function verse() {switch ($bodypart) { case 1: $bodypart = "right hand";break; case 2: $bodypart = "left foot";break;case 3: $bodypart = "left hand";break;case 3: $bodypart = "right foot";break;default: $bodypart = "ran out";}$output =<<<HEREHey! My name is Jo<br>And I work in a button factory<br>I have a husband, three kids, and a family.<br>One day my boss came up to me.<br>He said "Jo, are you busy?"<br>I said,"No"<br>He said to "push this button with your $bodypart"<br>HERE;return $output;}?> Edited September 25, 2009 by garyblack Link to comment Share on other sites More sharing options...
Synook Posted September 25, 2009 Report Share Posted September 25, 2009 Because you forgot to include $bodypart as a parameter in the verse() definition. Link to comment Share on other sites More sharing options...
garyblackpool Posted September 25, 2009 Author Report Share Posted September 25, 2009 Because you forgot to include $bodypart as a parameter in the verse() definition.Hi I changed the it to this and now its working thanks. <?print verse(1);print verse(2);print verse(3);print verse(4);print verse(5);print verse();function verse($bodypart) {switch ($bodypart) { case 1: $bodypart = "right hand";break; case 2: $bodypart = "left foot";break;case 3: $bodypart = "left hand";break;case 4: $bodypart = "right foot";break;case 5: $bodypart = "stop pushing them buttons";break;default: $bodypart = "ran out";}$output =<<<HEREHey! My name is Jo<br>And I work in a button factory<br>I have a wife, three kids, and a family.<br>One day my boss came up to me.<br>He said "Jo, are you busy?"<br>I said,"No"<br>He said to "push this button with your $bodypart"<br>I said hey okay<br> <br>HERE;return $output;}?> Gonna try and work on this a bit more thank. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now