Categoría: Tecnología al Día
Bitwise operators allow evaluation and manipulation of specific bits within an integer. < Scroll Horizontal disponible en esta tabla > Bitwise Operators Example Name Result $a & $b And Bits that are set in both $a and $b are set. $a | $b Or (inclusive or) Bits that are set in either $a or $b
The basic assignment operator is «=». Your first inclination might be to think of this as «equal to». Don’t. It really means that the left operand gets set to the value of the expression on the rights (that is, «gets set to»). The value of an assignment expression is the value assigned. That is, the
Remember basic arithmetic from school? These work just like those. < Scroll Horizontal disponible en esta tabla > Arithmetic Operators Example Name Result -$a Negation Opposite of $a. $a + $b Addition Sum of $a and $b. $a – $b Subtraction Difference of $a and $b. $a * $b Multiplication Product of $a and $b.
The precedence of an operator specifies how «tightly» it binds two expressions together. For example, in the expression 1 + 5 * 3, the answer is 16 and not 18 because the multiplication («*») operator has a higher precedence than the addition («+») operator. Parentheses may be used to force precedence, if necessary. For instance:
Operator Precedence Arithmetic Operators Assignment Operators Bitwise Operators Comparison Operators Error Control Operators Execution Operators Incrementing/Decrementing Operators Logical Operators String Operators Array Operators Type Operators An operator is something that you feed with one or more values (or expressions, in programming jargon) which yields another value (so that the construction itself becomes an expression). So
PHP provides a large number of predefined constants to any script which it runs. Many of these constants, however, are created by various extensions, and will only be present when those extensions are available, either via dynamic loading or because they have been compiled in. There are seven magical constants that change depending on where
Expressions are the most important building stones of PHP. In PHP, almost anything you write is an expression. The simplest yet most accurate way to define an expression is «anything that has a value». The most basic forms of expressions are constants and variables. When you type «$a = 5″, you’re assigning ‘5’ into $a.
A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script (except for magic constants, which aren’t actually constants). A constant is case-sensitive by default. By convention, constant identifiers are always uppercase. The name of a constant follows the same rules as
When a form is submitted to a PHP script, the information from that form is automatically made available to the script. There are many ways to access this information, for example: Example #1 A simple HTML form <form action=»foo.php» method=»post»> Name: <input type=»text» name=»username» /><br /> Email: <input type=»text» name=»email» /><br /> <input type=»submit» name=»submit»
Sometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically. A normal variable is set with a statement such as: <?php $a = ‘hello’; ?> A variable variable takes the value of a variable and treats that as the name of