Intro to PHP

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What does the ; do?

Instructional Seperator

What is a variable?

A symbolic representation of a value that can change over time, or "vary".

Define Floating Point Numbers

Floating point numbers (also known as "floats", "doubles", or "real numbers") can be specified using any of the following syntaxes: <?php $a = 1.234; $b = 1.2e3; $c = 7E-10; ?>

What are some examples of properly written variables? Which ones are not recommended?

$item $Item $myVariable $_book* $this_Variable $this-variable* $product3 $__bookPage*

What are the rules of a variable?

- Start with $ - Followed by a letter or underscore - Can contain numbers, letters, underscores, or dashes - No Spaces - CaSe SeNsItIvE

What are the different ways to create a comment?

// Single Line Comment # Single Line Comment /* Multiple Line Comment */

How large can a string be?

2GB

What is the function to check your php configuration?

<?php phpinfo(); ?>

PHP Syntax Good and Bad Form

Good Form: <?php ... ?> Bad Forms: <? ... ?> or <?= ... ?> or <% ... %>

Who created PHP and when was it invented?

PHP was created in 1994 by Rasmus Lerdorf while Zeev Suraski and Andi Gutmans rewrote the parser in 1997 into PHP 3

What does PHP stand for and where can you locate its documentation?

PHP: Hypertext Preprocessor www.php.net

Describe the PHP Operational Trail

The browser finds the page, connects to a .php file, that .php file is then processed while interacting with the database. Afterwards the page is transformed into HTML and sent back to the browser.

What is a string?

A string is series of characters, where a character is the same as a byte. This means that PHP only supports a 256-character set, and hence does not offer native Unicode support.

What are the accepted syntax for strings?

A string literal can be specified in four different ways: single quoted double quoted heredoc syntax nowdoc syntax (since PHP 5.3.0)

What is Floating Point Precision? (Not from Lynda)

Floating point numbers have limited precision. Although it depends on the system, PHP typically uses the IEEE 754 double precision format, which will give a maximum relative error due to rounding in the order of 1.11e-16. Non elementary arithmetic operations may give larger errors, and, of course, error propagation must be considered when several operations are compounded. Additionally, rational numbers that are exactly representable as floating point numbers in base 10, like 0.1 or 0.7, do not have an exact representation as floating point numbers in base 2, which is used internally, no matter the size of the mantissa. Hence, they cannot be converted into their internal binary counterparts without a small loss of precision. This can lead to confusing results: for example, floor((0.1+0.7)*10) will usually return 7 instead of the expected 8, since the internal representation will be something like 7.9999999999999991118.... So never trust floating number results to the last digit, and do not compare floating point numbers directly for equality. If higher precision is necessary, the arbitrary precision math functions and gmp functions are available. For a "simple" explanation, see the » floating point guide that's also titled "Why don't my numbers add up?"

What is a Integer?

Integers can be specified in decimal (base 10), hexadecimal (base 16), octal (base 8) or binary (base 2) notation, optionally preceded by a sign (- or +). <?php $a = 1234; // decimal number $a = -123; // a negative number $a = 0123; // octal number (equivalent to 83 decimal) $a = 0x1A; // hexadecimal number (equivalent to 26 decimal) ?>

What does LAMP, WAMP, MAMP, XAMP mean?

LAMP: Linux Apache MySQL PHP WAMP: Windows Apache MySQL PHP MAMP: Macintosh Apache MySQL PHP XAMP: Any Server Apache MySQL PHP

Does White-space Matter?

No, but note that: If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.


संबंधित स्टडी सेट्स

Unit 1: Structure and function of arteries, veins and capillaries

View Set

Unit 1 - Milestone 1 / Public Speaking

View Set

Module Five TestOut Practice Questions

View Set

Programming Fundamentals 1: Exam 4 (Ch 11 & 13)

View Set

Ch. 13 - Contract Performance, Breach, and Remedies

View Set