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
Copy file name to clipboardExpand all lines: exercises/stringify-to-demystify/problem/problem.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
`__toString()` a class magic method long-standing in PHP but never truly something you could rely on unless you rolled your own interface. All that has changed with the simple introduction of the `Stringable` interface in PHP 8.
1
+
`__toString()` a magic class method long-standing in PHP but never truly something you could rely on unless you rolled your own interface. All that has changed with the simple introduction of the `Stringable` interface in PHP 8.
2
2
3
-
A simple interface that requires the implementation of `__toString(): string`
3
+
`Stringable` is a simple interface that requires the implementation of `__toString(): string`
Create a program that reads JSON body of the request input stream (mimicking an API response). The body will need to be JSON decoded and will be a variation of the example below:
7
+
Create a program that reads the JSON body of the request input stream (mimicking an API response). The body will need to be JSON decoded and will be a variation of the example below:
8
8
9
9
```json
10
10
{
@@ -14,7 +14,7 @@ Create a program that reads JSON body of the request input stream (mimicking an
14
14
}
15
15
```
16
16
17
-
You will need to define a new class that implements `Stringable` and it's requirements. This class should take enough information from the request so that the `__toString` method can return a string like below:
17
+
You will need to define a new class that implements `Stringable` and it's method requirements. This class should take enough information from the request so that the `__toString` method can return a string like below:
18
18
19
19
```
20
20
Status: 401
@@ -37,11 +37,11 @@ To easily read the request body you can use `file_get_contents('php://input')`
0 commit comments