What a damn kludge ... you can never just assume something is there and/or works right.
Examples ... strftime exists, but not strptime WTF?
printf is completely hosed ... I have a formatted output statement that works fine in C and Python
"%03i%08.4f"
First problem ... PHP printf doesn't have an 'i' type specifier, have to use 'u'.
Now for y=3 and x = 1.23456, the result of this statement should be:
printf("%03u%08.4f", $y, $x);
003001.2346
instead I get
00300000001.2346
it pads the field before the decimal to 8 places, instead of the entire field to 8 places! 🙁
So, I try to work around it. I know the value of x will always be less then 1000, so I can add some if statements and pad it manually, like this:
if($x < 10)
printf("%03u00%6.4f", $y, $x);
Here's the result:
00300 1.2346
Who the fvck told it to put a space in there???
It seems every time I try something in PHP, I find some stupid cruft like this.
arghh
Fvck it, it's supposed to be my day off anyway, I'm going home.
Examples ... strftime exists, but not strptime WTF?
printf is completely hosed ... I have a formatted output statement that works fine in C and Python
"%03i%08.4f"
First problem ... PHP printf doesn't have an 'i' type specifier, have to use 'u'.
Now for y=3 and x = 1.23456, the result of this statement should be:
printf("%03u%08.4f", $y, $x);
003001.2346
instead I get
00300000001.2346
it pads the field before the decimal to 8 places, instead of the entire field to 8 places! 🙁
So, I try to work around it. I know the value of x will always be less then 1000, so I can add some if statements and pad it manually, like this:
if($x < 10)
printf("%03u00%6.4f", $y, $x);
Here's the result:
00300 1.2346
Who the fvck told it to put a space in there???
It seems every time I try something in PHP, I find some stupid cruft like this.
arghh
Fvck it, it's supposed to be my day off anyway, I'm going home.