11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 3 • <strong>PHP</strong> BASICSwww.it-ebooks.info■ Note Throughout this chapter, and indeed the rest of this book, when introducing functions I’ll refer to theirprototype. A prototype is simply the function’s definition, formalizing its name, input parameters, and the type ofvalue it returns, defined by a data type. If you don’t know what a data type is, see the “<strong>PHP</strong>’s Supported DataTypes” section later in this chapter.The print() StatementThe print() statement outputs data passed to it . Its prototype looks like this:int print(argument)All of the following are plausible print() statements:All these statements produce identical output:I love the summertime.■ Note Although the official syntax calls for the use of parentheses to enclose the argument, they’re not requiredbecause print() isn’t technically a function; it’s a language construct. Many programmers tend to forgo themsimply because the target argument is equally apparent without them.The print() statement’s return value is misleading because it will always return 1 regardless ofoutcome (the only outcome I’ve ever experienced using this statement is one in which the desiredoutput is sent to the browser). This differs from the behavior of most other functions in the sense thattheir return value often serves as an indicator of whether the function executed as intended.46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!