Skip to content

Boolean

Ryan Durham edited this page Nov 26, 2021 · 1 revision

XDR represents boolean values as integers. 0 is false and 1 is true. Any value passed in for encoding will be interpreted with the boolval() function to convert it to either true or false.

To encode a boolean value:

use StageRightLabs\PhpXdr\XDR;

// Encode
$xdr = XDR::fresh()->write(true, XDR::BOOL);

To decode a boolean value:

use StageRightLabs\PhpXdr\XDR;
$xdr = XDR::fresh()->write(true, XDR::BOOL);

// Decode
$bool = $xdr->read(XDR::BOOL); // true
Clone this wiki locally