Re: Problems using bitwise &
- From: Alexey Kulentsov <akul@xxxxxxxx>
- Date: Fri, 28 Mar 2008 13:30:22 +0000
Philluminati wrote:
$ip = $networkObjectRow['sipv4addr'];
$subnet = $networkObjectRow['eipv4addr'];
//make php treats these likes numbers and not strings
$ip += (int)0;
$subnet += (int)0;
$ip = (int)$networkObjectRow['sipv4addr'];
$subnet = (int)$networkObjectRow['eipv4addr'];
PHP _outputs_ it as signed integer. Try formatted output to clear this question:
print("<!-- sip F (ip=$ip,subnet=$subnet) returned is
$ans -->\n");
return ($ans);
However my output is like this:
<!-- sip F (ip=170419457,subnet=4294967040) returned is 170419456 -->
<!-- sip F (ip=170419457,subnet=4294967040) returned is 170419456 -->
<!-- sip F (ip=3388826225,subnet=4294967280) returned is -906141072 --
<!-- sip F (ip=3388826225,subnet=4294967280) returned is -906141072 --
<!-- sip F (ip=170419969,subnet=4294967040) returned is 170419968 -->
<!-- sip F (ip=170419969,subnet=4294967040) returned is 170419968 -->
Where the IP starts 17... the answer is correct. When the value starts
3388 the value is wrong.
printf("<!-- sip F (ip=%08X,subnet=%08X) returned is %08X -->\n",$ip,$subnet,$ans);
.
- References:
- Problems using bitwise &
- From: Philluminati
- Problems using bitwise &
- Prev by Date: PDF generation from HTML
- Next by Date: Re: usort() problem
- Previous by thread: Re: Problems using bitwise &
- Next by thread: PDF generation from HTML
- Index(es):
Relevant Pages
|