Jump to content

Is there an equivalent to Java cast to byte in PHP?


Andy-H

Recommended Posts

Just wondering if anyone knew of one? I have been looking for ages but can't find what I need.

 

 

In java:

 

 


public class Test {
    public static void main(String[] args) {
        System.out.println((byte)0xff);
    }
}

Outputs:

-1

 

 

I've tried things like


<?php
$var = pack('H', 0xff);
echo $var;
?>

But that doesn't output anything :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.