Skip to content

consolidate multiple unset() calls #9669

@interduo

Description

@interduo

Feature Request

code cleanup with calling once unset() instead of multiple,

Diff

formating when there more than 2 variables in unset():

-unset($accountlist['total']);
-unset($accountlist['order']);
-unset($accountlist['type']);
-unset($accountlist['kind']);
-unset($accountlist['customer']);
-unset($accountlist['domain']);
-unset($accountlist['direction']);
+unset(
+    $accountlist['total'],
+    $accountlist['order'],
+    $accountlist['type'],
+    $accountlist['kind'],
+    $accountlist['customer'],
+    $accountlist['domain'],
+    $accountlist['direction']
+);

formating when there are only two variables in unset():

-unset($accountlist['total']);
-unset($accountlist['order']);
+unset($accountlist['total'], $accountlist['order']);

There are more variadic functions like this one:

max
min
printf
sprintf
fprintf
vprintf
vsprintf
vfprintf
var_dump
array_merge
array_merge_recursive
array_intersect
array_intersect_assoc
array_intersect_key
array_diff
array_diff_assoc
array_diff_key
array_multisort
array_push
array_unshift
compact
isset

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions