Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions php/lesson2/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ Array
```
Err, wasn't expecting that? The PHP echo command has to convert values to strings to display them. Most of the time it knows what to do, but it doesn't like to second guess you so wants you to be more specific. So actually it's outputted the string `Array` and warned you with the `PHP Notice` line why it's not what you expected. We can use a `var_dump`, or a string function that can tell it how to format the array items. Here's an example:
```php
echo join(", ", [4, 5, 6]);
echo implode(", ", [4, 5, 6]);
```
This tells it to join each element in the array together with a comma, so the output becomes:
```
4, 5, 6
```
You don't have to have items of just one type in an array, you can mix them up. E.g:
```php
echo join(", ", ["odd", "squad", 4, true]); // displays odd, squad, 4, 1
echo implode(", ", ["odd", "squad", 4, true]); // displays odd, squad, 4, 1
```

#### Associative Arrays
Expand Down