1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/you-can-use-the-array-spread-syntax-to-pass-an-array-of-arguments-to-another-function.md
2022-01-07 18:32:23 +01:00

17 lines
No EOL
740 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 'You can use the array spread syntax to pass an array of arguments to another function'
tweet_id: '1471864644562305025'
thread_slug: weekly-thread-2021-01
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FGepj8mWQAUf2R_.jpg'
created_at: 2021-12-17T15:27:31+00:00
slug: you-can-use-the-array-spread-syntax-to-pass-an-array-of-arguments-to-another-function
---
🔥 You can use array spreading to pass an array as arguments to another function. #php
Heres a self-contained example where we spread the array output of sys_getloadavg. That function returns an array with three elements.
https://github.com/spatie/cpu-load-health-check/blob/70f387d5167c24d4000d825a5bddab2504d557fb/src/CpuLoad.php#L17
#php