Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Merge pull request #37 from shah78677/master
Browse files Browse the repository at this point in the history
Added 2 code snippets in php
  • Loading branch information
rickwest authored Oct 8, 2019
2 parents 5559e8d + cbc3193 commit 43ee7ed
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
- [Cem Ugur Karacam](https://github.com/cemuka)
- [Erica Perry](https://github.com/comealongerica)
- [Grant Glidewell](https://github.com/grantglidewell)
- [Amir Kiumarsi](https://github.com/codacy20)
- [Amir Kiumarsi](https://github.com/codacy20)
- [Shah Quadri](https://github.com/shah78677)
30 changes: 30 additions & 0 deletions source/snippets/php/arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,34 @@ sort($array); //sort() function
$array = ["Car", "Bike", "Train"];

rsort($array); //rsort() function
```

### Multi-dimensional arrays
```php
$students = array(
//Student Name, Age and Behaviour
array('Jack', 14, 'Good'),
array('Mary', 13, 'Good'),
);
//print_r($students)
```

### Multi-dimensional associative arrays
```php
$marks = array(
//Name of student is key
"Jack" => array(
//key-value pairs
"Maths" => 95,
"Science" => 84,
"History" => 48,
),

"Mary" => array(
"Maths" => 78,
"Science" => 76,
"History" => 64,
),
);
//print_r($marks)
```

0 comments on commit 43ee7ed

Please sign in to comment.