You think Hello World in C is too long and complicated for teaching to a beginner?
Try writing Hello World in COBOL.
I think the solution to the “magic” problem is to just live with. Show your students the program, tell them to type it in just exactly as is, all the magic words included, and promise that you’ll get around to explaining each one in due time. Then, for starters, just focus on the one line that actually does something.
In contrast, I had an utterly awful textbook once, the authors of which felt that they just couldn’t have the student writing a function call like printf("Hello World
"); without fully explaining all about functions. So the book started with teaching functions, which was way over the heads of any beginner at that stage.
I had a friend back in college days, a CS grad student, who taught FORTRAN classes (that being the dominant language of the day). He took that approach with the dreaded FORMAT statements. For the first several weeks of the quarter, he simply hand-fed them the FORMAT statements to use in their programs, promising that the fateful day would arrive soon enough that he would actually teach them about it.
I think PHP is sort of an abomination to teach as a first language. It’s kind of a crappy language altogether. The syntax and collection of functions seem to be a rather thrown-together ad-hoc hodge-podge. My book has pages of tables listing all the special rules about what data types and values you can compare to what, and what the results will be.
You’re right that it’s good to have a language that doesn’t hide too much, for a beginner. As you know, I’ve railed about languages that hide too much, especially about how recursion works. Even C keeps that kinda-sorta mysterious. You have to teach your student about stacks and local variables. Well, you have to teach about that anyway.
I first learned recursion in assembly language – and on a CDC 6400, which didn’t have any native support for stacks or stack operations! That’s how you learn how things really get done! Maybe beginners should be learning assembly language! And maybe even preferably on an old-architecture machine.