I need to pass an int value inside a float from java code to php. The reason is that the third-party API that I have to use in between accepts only float values.
In java I have the following code, that works as expected:
int i1 = (int) (System.currentTimeMillis() / 1000L);
float f = Float.intBitsToFloat(t);
int i2 = Float.floatToIntBits(f);
//i1 == i2
Then I pass float value from Float.intBitsToFloat() to the third-party API and it sends a string to my server with float:
"value1":1.4237714E9
In php I receive and parse many such strings and get an array:
{
"value1" => 1.4237714E9, (Number)
"value2" => 1.4537614E9 (Number)
...
}
Now I need to make Float.floatToIntBits() for each element in php, but I'm not sure how. Will these php numbers be 4 bytes long? Or maybe I can somehow get integer while parsing from string? Any suggestions? Thank you in advance!