1 | <?php |
||
7 | class Extract |
||
8 | { |
||
9 | /** |
||
10 | * Extract keys from a collection, like `only`, except: |
||
11 | * - If a value doesn't exist, it returns null instead of omitting it |
||
12 | * - It returns a collection without keys, so `list()` can be used. |
||
13 | * |
||
14 | * @return \Illuminate\Support\Collection |
||
15 | */ |
||
16 | public function extract() |
||
26 | } |
||
27 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: