Skip to content

Commit

Permalink
fix example str_pad direction
Browse files Browse the repository at this point in the history
  • Loading branch information
aldas committed Jun 8, 2021
1 parent 1fb85de commit c39a0e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
$connection = BinaryStreamConnection::getBuilder()
->setPort($port)
->setHost($ip)
->setConnectTimeoutSec(1.5) // timeout when establishing connection to the server
->setWriteTimeoutSec(0.5) // timeout when writing/sending packet to the server
->setReadTimeoutSec(1.0) // timeout when waiting response from server
->build();


Expand Down Expand Up @@ -69,8 +72,8 @@
$highByteAsInt = $word->getHighByteAsInt();
$lowByteAsInt = $word->getLowByteAsInt();
$result[$address] = [
'highByte' => '0x' . str_pad(dechex($highByteAsInt), 2, '0') . ' / ' . $highByteAsInt . ' / "&#' . $highByteAsInt . ';"',
'lowByte' => '0x' . str_pad(dechex($lowByteAsInt), 2, '0') . ' / ' . $lowByteAsInt . ' / "&#' . $lowByteAsInt . ';"',
'highByte' => '0x' . str_pad(dechex($highByteAsInt), 2, '0', STR_PAD_LEFT) . ' / ' . $highByteAsInt . ' / "&#' . $highByteAsInt . ';"',
'lowByte' => '0x' . str_pad(dechex($lowByteAsInt), 2, '0', STR_PAD_LEFT) . ' / ' . $lowByteAsInt . ' / "&#' . $lowByteAsInt . ';"',
'highByteBits' => sprintf('%08d', decbin($highByteAsInt)),
'lowByteBits' => sprintf('%08d', decbin($lowByteAsInt)),
'int16' => $word->getInt16(),
Expand Down

0 comments on commit c39a0e5

Please sign in to comment.