You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Of course that's not very useful since you could've just used `strtoupper('hello')` and be done with it, but the goal is to make multi-method calls on a value easier to read and write:
Note that in comparison to the original RFC, there's no need to pass the initial value to methods that receive the value as first parameter and have no other required parameters. The previous value is always passed as first parameter. In effect, both of the following examples will work:
In contrast, if a method takes e.g. a setting before the previous value, we need to set it manually using the replacement identifier (the globally available `PIPED_VALUE` constant). This identifier can be placed *anywhere* in the method call, it will simply be replaced by the previous value.
101
101
102
102
```php
103
-
take(['key' => 'value'])
103
+
Pipe::from(['key' => 'value'])
104
104
->array_search('value', PIPED_VALUE)
105
105
->get();
106
106
@@ -112,7 +112,7 @@ take(['key' => 'value'])
112
112
Sometimes standard methods don't cut it and you need to perform a custom operation on a value in the process. You can do so using a closure:
0 commit comments