mdref.json config
[mdref/mdref-http] / http / Message / rewind.md
1 # void http\Message::rewind()
2
3 Implements Iterator.
4
5 ## Params:
6
7 None.
8
9 ## Example:
10
11 <?php
12 $types = ["message", "request", "response"];
13 $message = new http\Message("GET / HTTP/1.1\n".
14 "HTTP/1.1 200\n".
15 "GET / HTTP/1.0\n".
16 "HTTP/1.0 426"
17 );
18 foreach ($message as $key => $msg) {
19 printf("Key %d is a %8s: %s\n",
20 $key, $types[$msg->getType()],
21 $msg->getInfo()
22 );
23 }
24 ?>
25
26 Yields:
27
28 Key 2 is a response: HTTP/1.0 426
29 Key 8 is a request: GET / HTTP/1.0
30 Key 6 is a response: HTTP/1.1 200
31 Key 4 is a request: GET / HTTP/1.1