Skip to content

Commit c39a0e5

Browse files
committed
fix example str_pad direction
1 parent 1fb85de commit c39a0e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

examples/index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
$connection = BinaryStreamConnection::getBuilder()
3333
->setPort($port)
3434
->setHost($ip)
35+
->setConnectTimeoutSec(1.5) // timeout when establishing connection to the server
36+
->setWriteTimeoutSec(0.5) // timeout when writing/sending packet to the server
37+
->setReadTimeoutSec(1.0) // timeout when waiting response from server
3538
->build();
3639

3740

@@ -69,8 +72,8 @@
6972
$highByteAsInt = $word->getHighByteAsInt();
7073
$lowByteAsInt = $word->getLowByteAsInt();
7174
$result[$address] = [
72-
'highByte' => '0x' . str_pad(dechex($highByteAsInt), 2, '0') . ' / ' . $highByteAsInt . ' / "&#' . $highByteAsInt . ';"',
73-
'lowByte' => '0x' . str_pad(dechex($lowByteAsInt), 2, '0') . ' / ' . $lowByteAsInt . ' / "&#' . $lowByteAsInt . ';"',
75+
'highByte' => '0x' . str_pad(dechex($highByteAsInt), 2, '0', STR_PAD_LEFT) . ' / ' . $highByteAsInt . ' / "&#' . $highByteAsInt . ';"',
76+
'lowByte' => '0x' . str_pad(dechex($lowByteAsInt), 2, '0', STR_PAD_LEFT) . ' / ' . $lowByteAsInt . ' / "&#' . $lowByteAsInt . ';"',
7477
'highByteBits' => sprintf('%08d', decbin($highByteAsInt)),
7578
'lowByteBits' => sprintf('%08d', decbin($lowByteAsInt)),
7679
'int16' => $word->getInt16(),

0 commit comments

Comments
 (0)