First PHP calls the verse function. The verse() function then starts from the top of the function in the switch statement. Every time it sees the word 'case' it compares the value of $stanza to the value of the 'case'. Since the first time verse is called the value of $stanza is 1, the first 'case' matches $stanza and the code within the 'case' is executed. That code assigns the value of "thumb" to $place, and $place is now a variable that will only have tha value within the verse function. PHP then sees the keyword 'break' which terminates the switch statement and puts the program pointer at the first line after the switch statement. If that keyword 'break' wasn't there, PHP would have checked the next case instead of jumping out of the switch statement. After the switch statement, we come to some PHP 'heredoc'. Within the 'heredoc', $stanze and $place are substituted with their actual values (this is technically called "string parsing"). $output is then assigned the value of the entire 'heredoc' string. Then verse() returns the value of $output. So really in the end, the verse() function isn't returning a single digit string but the entire string generated by the 'heredoc'.