I am attempting to convert the following Java code to PHP but I'm having issues with finding the equivalent of getBytes()
JAVA CODE
import java.math.BigInteger;
public class Test {
public static void main(String[] ar){
String a="4F23DE12";
BigInteger b = new BigInteger(a.getBytes());
System.out.println(b); //Result is 3766753334112104754
}
}
The Java result is 3766753334112104754 but my attempt with PHP is not giving the same result.
PHP CODE
use phpseclib3\Math\BigInteger;
$a="4F23DE12";
$b = new BigInteger($a);
echo $b; //Result is 4
The PHP result is 4. The issue seems to be from getBytes() and I have tried String to byte array in php and php equivalent of java getBytes() but still no solution.
In debugging it, I also tried System.out.println("4F23DE12".getBytes());
in Java, the result was [B@6d06d69c
but I haven't found an exact equivalent in PHP.
Please I will appreciate any help on how to use PHP to get the same Java result (3766753334112104754)