I've been dabbling in PHP for a while now and after pages and pages of documentation, I still have a couple lingering questions.
1) What is => used for exactly? I know that -> is for properties of classes but I haven't grasped => yet.
2) What is the function of //echo "Whatever" ? // represents a comment right?
Any and all assistance would be appreciated, thanks.
Some Newbie Questions
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Re: Some Newbie Questions
It's used in a few places, when assigning values to keys in arrays, e.g.:trent2800 wrote:1) What is => used for exactly? I know that -> is for properties of classes but I haven't grasped => yet.
Code: Select all
$my_array = array(
'key1' => 'value1',
'key2' => 'value2'
);Code: Select all
foreach ($my_array as $key => $value) {
echo $key.': '.$value;
}// does start a comment sotrent2800 wrote:2) What is the function of //echo "Whatever" ? // represents a comment right?
Code: Select all
// echo 'whatever';Mac