Possible Duplicate: What is “:” in PHP?
What does the :
mean in the following PHP code?
<?php while (have_posts()) : the_post(); ?>
It means you pass a reference to the string into the method. All changes done to the string within the method will be reflected also outside that method in your code.
The object operator, -> , is used in object scope to access methods and properties of an object. It's meaning is to say that what is on the right of the operator is a member of the object instantiated into the variable on the left side of the operator. Instantiated is the key term here.
=> is the separator for associative arrays. In the context of that foreach loop, it assigns the key of the array to $user and the value to $pass .
Concatenation of two strings in PHP.
It's called an Alternative Syntax For Control Structures. You should have an endwhile;
somewhere after that. Basically, it allows you to omit braces {}
from a while to make it look "prettier"...
As far as your edit, it's called the Ternary Operator (it's the third section). Basically it's an assignment shorthand.
$foo = $first ? $second : $third;
is the same as saying (Just shorter):
if ($first) { $foo = $second; } else { $foo = $third; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With