Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #4467 > unrolled thread
| Started by | lb <lb2048@pobox.com.delete> |
|---|---|
| First post | 2012-01-16 01:10 +0000 |
| Last post | 2012-01-17 02:35 +0000 |
| Articles | 20 on this page of 23 — 7 participants |
Back to article view | Back to comp.lang.php
Implied cast differs from explicit cast lb <lb2048@pobox.com.delete> - 2012-01-16 01:10 +0000
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-15 20:51 -0500
Re: Implied cast differs from explicit cast lb <lb2048@pobox.com.delete> - 2012-01-16 03:08 +0000
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-15 22:39 -0500
Re: Implied cast differs from explicit cast Arno Welzel <usenet@arnowelzel.de> - 2012-01-16 08:42 +0100
Re: Implied cast differs from explicit cast Curtis Dyer <dyer85@gmail.com> - 2012-01-16 09:04 +0000
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-16 08:25 -0500
Re: Implied cast differs from explicit cast "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-16 19:51 +0100
Re: Implied cast differs from explicit cast The Natural Philosopher <tnp@invalid.invalid> - 2012-01-16 13:28 +0000
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-16 08:45 -0500
Re: Implied cast differs from explicit cast Arno Welzel <usenet@arnowelzel.de> - 2012-01-17 06:59 +0100
Re: Implied cast differs from explicit cast Arno Welzel <usenet@arnowelzel.de> - 2012-01-17 07:00 +0100
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-17 08:17 -0500
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-17 08:16 -0500
Re: Implied cast differs from explicit cast Arno Welzel <usenet@arnowelzel.de> - 2012-01-19 13:36 +0100
Re: Implied cast differs from explicit cast Arno Welzel <usenet@arnowelzel.de> - 2012-01-19 13:39 +0100
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-19 09:06 -0500
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-19 09:05 -0500
Re: Implied cast differs from explicit cast The Natural Philosopher <tnp@invalid.invalid> - 2012-01-19 15:01 +0000
Re: Implied cast differs from explicit cast Jerry Stuckle <jstucklex@attglobal.net> - 2012-01-19 14:41 -0500
Re: Implied cast differs from explicit cast "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-01-16 09:49 +0100
Re: Implied cast differs from explicit cast "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2012-01-16 11:48 +0100
Re: Implied cast differs from explicit cast lb <lb2048@pobox.com.delete> - 2012-01-17 02:35 +0000
Page 1 of 2 [1] 2 Next page →
| From | lb <lb2048@pobox.com.delete> |
|---|---|
| Date | 2012-01-16 01:10 +0000 |
| Subject | Implied cast differs from explicit cast |
| Message-ID | <4f1378ee$0$16741$882e7ee2@usenet-news.net> |
When converting some strings to int (or double), I am finding that
an implied cast get different results from explicit cast. This happens
when the string contains a hex representation. The implied cast converts
the hex value, but the explicit cast returns 0. The manual under "String
conversion to numbers" says nothing about it allowing hex values. This is
with PHP-5.3.9 and older.
Script:
<?php
$s1 = '0x12';
$t1 = $s1 + 0;
echo "Implied cast t1=$t1\n";
$t2 = (int)$s1 + 0;
echo "Explicit cast t2=$t2\n";
Output:
Implied cast t1=18
Explicit cast t2=0
I think this is odd. A side problem is that is_numeric('0x12') is true, but
((int)'0x12') is 0. Does anyone think this a bug?
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-15 20:51 -0500 |
| Message-ID | <jevvqe$1gk$1@dont-email.me> |
| In reply to | #4467 |
On 1/15/2012 8:10 PM, lb wrote:
> When converting some strings to int (or double), I am finding that
> an implied cast get different results from explicit cast. This happens
> when the string contains a hex representation. The implied cast converts
> the hex value, but the explicit cast returns 0. The manual under "String
> conversion to numbers" says nothing about it allowing hex values. This is
> with PHP-5.3.9 and older.
>
> Script:
> <?php
> $s1 = '0x12';
> $t1 = $s1 + 0;
> echo "Implied cast t1=$t1\n";
> $t2 = (int)$s1 + 0;
> echo "Explicit cast t2=$t2\n";
>
> Output:
> Implied cast t1=18
> Explicit cast t2=0
>
>
> I think this is odd. A side problem is that is_numeric('0x12') is true, but
> ((int)'0x12') is 0. Does anyone think this a bug?
>
>
No, it is not. '0x12' is a hex number, not an integer. (int)'0x12'
converts this correctly to 0.
If you want to convert a hex number to an integer, you need to use
hexdec(), which is what the implied conversion does.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | lb <lb2048@pobox.com.delete> |
|---|---|
| Date | 2012-01-16 03:08 +0000 |
| Message-ID | <4f139498$0$16818$882e7ee2@usenet-news.net> |
| In reply to | #4468 |
jstucklex@attglobal.net wrote: >... > No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' > converts this correctly to 0. OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? Why are they different? Aren't they both doing 'string conversion to number'?
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-15 22:39 -0500 |
| Message-ID | <jf066c$qig$1@dont-email.me> |
| In reply to | #4469 |
On 1/15/2012 10:08 PM, lb wrote: > jstucklex@attglobal.net wrote: >> ... >> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >> converts this correctly to 0. > > OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? > > Why are they different? Aren't they both doing 'string conversion to number'? As I said - '0x12' is a hex value, not an integer. You are trying to convert it as if it were a string representation of an integer. The implicit conversion recognizes it is a hex value and uses the appropriate conversion. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-01-16 08:42 +0100 |
| Message-ID | <4F13D4E3.3010208@arnowelzel.de> |
| In reply to | #4470 |
Jerry Stuckle, 2012-01-16 04:39: > On 1/15/2012 10:08 PM, lb wrote: >> jstucklex@attglobal.net wrote: >>> ... >>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>> converts this correctly to 0. >> >> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? >> >> Why are they different? Aren't they both doing 'string conversion to >> number'? > > As I said - '0x12' is a hex value, not an integer. You are trying to > convert it as if it were a string representation of an integer. The > implicit conversion recognizes it is a hex value and uses the > appropriate conversion. There is no difference between "hex value" and "integer" - both 0x12 and 18 are just different representations of the same value. The problem is that the explizit cast from string to int does not take this into account. Example: <?php $a = 0x12; $b = 18; print $a-$b; ?> Result: 0 -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | Curtis Dyer <dyer85@gmail.com> |
|---|---|
| Date | 2012-01-16 09:04 +0000 |
| Message-ID | <jf0p64$mil$2@dont-email.me> |
| In reply to | #4472 |
Arno Welzel <usenet@arnowelzel.de> wrote: > Jerry Stuckle, 2012-01-16 04:39: > >> On 1/15/2012 10:08 PM, lb wrote: >>> jstucklex@attglobal.net wrote: >>>> ... >>>> No, it is not. '0x12' is a hex number, not an integer. >>>> (int)'0x12' converts this correctly to 0. As Arno points out, the hex value *is* an integer (once converted from a string, in this case). >>> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? >>> >>> Why are they different? Aren't they both doing 'string >>> conversion to number'? >> >> As I said - '0x12' is a hex value, not an integer. You are >> trying to convert it as if it were a string representation of >> an integer. The implicit conversion recognizes it is a hex >> value and uses the appropriate conversion. > > There is no difference between "hex value" and "integer" - both > 0x12 and 18 are just different representations of the same > value. The problem is that the explizit cast from string to int > does not take this into account. The problem, as far as I can tell, has to do with the implicit behavior of the "(int)$str" cast. Its default behavior seems to be identicle to: /* operates on base ten values; 10 is the default base when the * second parameter is omitted. */ intval($str, 10); So, '0x12' is obviously then considered an invalid base ten integer, thus the expression, "(int)'0x12'" yields 0. If you want to convert a hex value, either use hexdec() or use: intval($str, 16); Note, however, the behavior of hexdec($str) and intval($str, 16) are not identicle! In some cases, hexdec() may be preferable, as it will attempt to represent values too large for integers as floating-point values. It also disregards non-hex value characters in the string. RTM here: <http://php.net/intval> <http://php.net/hexdec> -- Curtis Dyer <?$x='<?$x=%c%s%c;printf($x,39,$x,39);?>';printf($x,39,$x,39);?>
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-16 08:25 -0500 |
| Message-ID | <jf18fo$jjs$1@dont-email.me> |
| In reply to | #4472 |
On 1/16/2012 2:42 AM, Arno Welzel wrote: > Jerry Stuckle, 2012-01-16 04:39: > >> On 1/15/2012 10:08 PM, lb wrote: >>> jstucklex@attglobal.net wrote: >>>> ... >>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>> converts this correctly to 0. >>> >>> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? >>> >>> Why are they different? Aren't they both doing 'string conversion to >>> number'? >> >> As I said - '0x12' is a hex value, not an integer. You are trying to >> convert it as if it were a string representation of an integer. The >> implicit conversion recognizes it is a hex value and uses the >> appropriate conversion. > > There is no difference between "hex value" and "integer" - both 0x12 and > 18 are just different representations of the same value. The problem is > that the explizit cast from string to int does not take this into account. > > Example: > > <?php > $a = 0x12; > $b = 18; > print $a-$b; > ?> > > Result: > > 0 > In C/C++ there is no difference. However, in PHP there is. The 'x' is not a valid decimal character, so (int) '0x12' returns 0. The correct function to use when converting hexadecimal strings is hexdec(). -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
|---|---|
| Date | 2012-01-16 19:51 +0100 |
| Message-ID | <9nj9suFg68U1@mid.uni-berlin.de> |
| In reply to | #4481 |
Am 16.01.2012 14:25, schrieb Jerry Stuckle: > On 1/16/2012 2:42 AM, Arno Welzel wrote: >> Jerry Stuckle, 2012-01-16 04:39: >> >>> On 1/15/2012 10:08 PM, lb wrote: >>>> jstucklex@attglobal.net wrote: >>>>> ... >>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>> converts this correctly to 0. >>>> >>>> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? >>>> >>>> Why are they different? Aren't they both doing 'string conversion to >>>> number'? >>> >>> As I said - '0x12' is a hex value, not an integer. You are trying to >>> convert it as if it were a string representation of an integer. The >>> implicit conversion recognizes it is a hex value and uses the >>> appropriate conversion. >> >> There is no difference between "hex value" and "integer" - both 0x12 and >> 18 are just different representations of the same value. The problem is >> that the explizit cast from string to int does not take this into account. >> --cut >> > > In C/C++ there is no difference. However, in PHP there is. The 'x' is not a valid > decimal character, so (int) '0x12' returns 0. > > The correct function to use when converting hexadecimal strings is hexdec(). The last two sentences sound correct to me, so far. Looks like you are trying to think like PHP. But this does not make things better here, because PHP (the Zend T_INT_CAST) is just half-witted here. /Str.
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-01-16 13:28 +0000 |
| Message-ID | <jf18lk$na6$1@news.albasani.net> |
| In reply to | #4469 |
lb wrote: > jstucklex@attglobal.net wrote: >> ... >> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >> converts this correctly to 0. Looks like Jerry doesn't know what an integer is either. A hex number of course *is* an integer, unless its a hex representation of floating point. Killfile the prat like I have. > > OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? > > Why are they different? Aren't they both doing 'string conversion to number'? Don't expect Jerry to have a clue because its either an integer number or a non numeric string? I have given up trying to second guess PHP in casting. One keeps things very simple as with a 2 year old (or jerry) when using PHP. It can understand 18 It can understand 'eighteeen' Lord knows what it does with '18' As for 0x12...man, you are pushing the boat out, there. Stop expecting PHP to be more than it is, a quick hack that writes good web pages faster than almost anything else. If you want a language that has a rule set and sticks to it rigidly, that's C.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-16 08:45 -0500 |
| Message-ID | <jf19m7$rbt$1@dont-email.me> |
| In reply to | #4482 |
On 1/16/2012 8:28 AM, The Natural Philosopher wrote: > lb wrote: >> jstucklex@attglobal.net wrote: >>> ... >>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>> converts this correctly to 0. > > Looks like Jerry doesn't know what an integer is either. > > A hex number of course *is* an integer, unless its a hex representation > of floating point. > > Killfile the prat like I have. > > 0x12 is not an integer. It is a hexadecimal value. It can have the same bit pattern as an integer - but it can also have the same bit pattern as a character (Ctrl-R, to be exact). >> >> OK, but if (int)'0x12' is 0, why is '0x12'+0 == 18? >> >> Why are they different? Aren't they both doing 'string conversion to >> number'? > > Don't expect Jerry to have a clue > > because its either an integer number or a non numeric string? > > I have given up trying to second guess PHP in casting. > > One keeps things very simple as with a 2 year old (or jerry) when using > PHP. > > It can understand 18 > > It can understand 'eighteeen' > > Lord knows what it does with '18' > > > As for 0x12...man, you are pushing the boat out, there. > > Stop expecting PHP to be more than it is, a quick hack that writes good > web pages faster than almost anything else. > > If you want a language that has a rule set and sticks to it rigidly, > that's C. > You're mixing C/C++ and PHP. They are not the same language. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-01-17 06:59 +0100 |
| Message-ID | <4F150E2E.80003@arnowelzel.de> |
| In reply to | #4483 |
Jerry Stuckle, 2012-01-16 14:45: > On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >> lb wrote: >>> jstucklex@attglobal.net wrote: >>>> ... >>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>> converts this correctly to 0. >> >> Looks like Jerry doesn't know what an integer is either. >> >> A hex number of course *is* an integer, unless its a hex representation >> of floating point. >> >> Killfile the prat like I have. >> >> > > 0x12 is not an integer. It is a hexadecimal value. No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the value 18. There is no thing like "hexadecimal value" and "0x12" is a *string* and not a number at all. In fact PHP only knows to types of numbers: integers and floating point. There is no "hexadecimal" data type. > It can have the same bit pattern as an integer - but it can also have > the same bit pattern as a character (Ctrl-R, to be exact). Which also applies to the value 18 - this can also be the value of a character. Example: <?php $a = 0x12; print $a; ?> Result: Value of $a: 18, type of $a: integer So you see 0x12 *is* an integer. Of course "0x12" (including the quotes) is a string and *converting* the string to a number may need attention to the representation of the number within the string. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-01-17 07:00 +0100 |
| Message-ID | <4F150E69.4000407@arnowelzel.de> |
| In reply to | #4491 |
Arno Welzel, 2012-01-17 06:59: > Jerry Stuckle, 2012-01-16 14:45: > >> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>> lb wrote: >>>> jstucklex@attglobal.net wrote: >>>>> ... >>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>> converts this correctly to 0. >>> >>> Looks like Jerry doesn't know what an integer is either. >>> >>> A hex number of course *is* an integer, unless its a hex representation >>> of floating point. >>> >>> Killfile the prat like I have. >>> >>> >> >> 0x12 is not an integer. It is a hexadecimal value. > > No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the > value 18. There is no thing like "hexadecimal value" and "0x12" is a > *string* and not a number at all. > > In fact PHP only knows to types of numbers: integers and floating point. > There is no "hexadecimal" data type. > >> It can have the same bit pattern as an integer - but it can also have >> the same bit pattern as a character (Ctrl-R, to be exact). > > Which also applies to the value 18 - this can also be the value of a > character. > > Example: > > <?php > $a = 0x12; > > print $a; > ?> > > Result: > > Value of $a: 18, type of $a: integer Sorry - the example was not complete: <?php $a = 0x12; $a = intval($a, 16); print 'Value of $a: ' . $a . ', type of $a: ' . gettype($a); ?> -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-17 08:17 -0500 |
| Message-ID | <jf3scp$nev$2@dont-email.me> |
| In reply to | #4492 |
On 1/17/2012 1:00 AM, Arno Welzel wrote: > Arno Welzel, 2012-01-17 06:59: > >> Jerry Stuckle, 2012-01-16 14:45: >> >>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>> lb wrote: >>>>> jstucklex@attglobal.net wrote: >>>>>> ... >>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>> converts this correctly to 0. >>>> >>>> Looks like Jerry doesn't know what an integer is either. >>>> >>>> A hex number of course *is* an integer, unless its a hex representation >>>> of floating point. >>>> >>>> Killfile the prat like I have. >>>> >>>> >>> >>> 0x12 is not an integer. It is a hexadecimal value. >> >> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >> value 18. There is no thing like "hexadecimal value" and "0x12" is a >> *string* and not a number at all. >> >> In fact PHP only knows to types of numbers: integers and floating point. >> There is no "hexadecimal" data type. >> >>> It can have the same bit pattern as an integer - but it can also have >>> the same bit pattern as a character (Ctrl-R, to be exact). >> >> Which also applies to the value 18 - this can also be the value of a >> character. >> >> Example: >> >> <?php >> $a = 0x12; >> >> print $a; >> ?> >> >> Result: >> >> Value of $a: 18, type of $a: integer > > Sorry - the example was not complete: > > <?php > $a = 0x12; > > $a = intval($a, 16); > > print 'Value of $a: ' . $a . ', type of $a: ' . gettype($a); > ?> > > > Sure. You explicitly converted the hexadecimal value to an integer. What do you expect? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-17 08:16 -0500 |
| Message-ID | <jf3sb5$nev$1@dont-email.me> |
| In reply to | #4491 |
On 1/17/2012 12:59 AM, Arno Welzel wrote: > Jerry Stuckle, 2012-01-16 14:45: > >> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>> lb wrote: >>>> jstucklex@attglobal.net wrote: >>>>> ... >>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>> converts this correctly to 0. >>> >>> Looks like Jerry doesn't know what an integer is either. >>> >>> A hex number of course *is* an integer, unless its a hex representation >>> of floating point. >>> >>> Killfile the prat like I have. >>> >>> >> >> 0x12 is not an integer. It is a hexadecimal value. > > No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the > value 18. There is no thing like "hexadecimal value" and "0x12" is a > *string* and not a number at all. > No, it is a hexadecimal value. It may be an integer, it may be a character, it may be a set of flags... It does not have to be an integer. > In fact PHP only knows to types of numbers: integers and floating point. > There is no "hexadecimal" data type. > Excuse me - there is. See hexdec(). >> It can have the same bit pattern as an integer - but it can also have >> the same bit pattern as a character (Ctrl-R, to be exact). > > Which also applies to the value 18 - this can also be the value of a > character. > > Example: > > <?php > $a = 0x12; > > print $a; > ?> > > Result: > > Value of $a: 18, type of $a: integer > > So you see 0x12 *is* an integer. > > Of course "0x12" (including the quotes) is a string and *converting* the > string to a number may need attention to the representation of the > number within the string. > > All it is is a representation of bits in a byte. How it is used determines the datatype. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-01-19 13:36 +0100 |
| Message-ID | <4F180E42.9010502@arnowelzel.de> |
| In reply to | #4496 |
Jerry Stuckle, 2012-01-17 14:16: > On 1/17/2012 12:59 AM, Arno Welzel wrote: >> Jerry Stuckle, 2012-01-16 14:45: >> >>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>> lb wrote: >>>>> jstucklex@attglobal.net wrote: >>>>>> ... >>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>> converts this correctly to 0. >>>> >>>> Looks like Jerry doesn't know what an integer is either. >>>> >>>> A hex number of course *is* an integer, unless its a hex representation >>>> of floating point. >>>> >>>> Killfile the prat like I have. >>>> >>>> >>> >>> 0x12 is not an integer. It is a hexadecimal value. >> >> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >> value 18. There is no thing like "hexadecimal value" and "0x12" is a >> *string* and not a number at all. >> > > No, it is a hexadecimal value. It may be an integer, it may be a > character, it may be a set of flags... It does not have to be an integer. > >> In fact PHP only knows to types of numbers: integers and floating point. >> There is no "hexadecimal" data type. >> > > Excuse me - there is. See hexdec(). <http://php.net/manual/en/function.hexdec.php> You don't know what a data type is? Do you? See <http://www.php.net/manual/en/language.types.php> and show me, where the "hexadecimal data type" is explained. m( -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Date | 2012-01-19 13:39 +0100 |
| Message-ID | <4F180EEB.60900@arnowelzel.de> |
| In reply to | #4517 |
Arno Welzel, 2012-01-19 13:36: > Jerry Stuckle, 2012-01-17 14:16: > >> On 1/17/2012 12:59 AM, Arno Welzel wrote: >>> Jerry Stuckle, 2012-01-16 14:45: >>> >>>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>>> lb wrote: >>>>>> jstucklex@attglobal.net wrote: >>>>>>> ... >>>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>>> converts this correctly to 0. >>>>> >>>>> Looks like Jerry doesn't know what an integer is either. >>>>> >>>>> A hex number of course *is* an integer, unless its a hex representation >>>>> of floating point. >>>>> >>>>> Killfile the prat like I have. >>>>> >>>>> >>>> >>>> 0x12 is not an integer. It is a hexadecimal value. >>> >>> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >>> value 18. There is no thing like "hexadecimal value" and "0x12" is a >>> *string* and not a number at all. >>> >> >> No, it is a hexadecimal value. It may be an integer, it may be a >> character, it may be a set of flags... It does not have to be an integer. >> >>> In fact PHP only knows to types of numbers: integers and floating point. >>> There is no "hexadecimal" data type. >>> >> >> Excuse me - there is. See hexdec(). > > <http://php.net/manual/en/function.hexdec.php> > > You don't know what a data type is? Do you? > > See <http://www.php.net/manual/en/language.types.php> and show me, where > the "hexadecimal data type" is explained. And you should read the section about *integer* literal in <http://www.php.net/manual/en/language.types.integer.php> very carefully. There is no thing as "conversion of hexadecimal values to an integer". EOD for me. -- Arno Welzel http://arnowelzel.de http://de-rec-fahrrad.de
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-19 09:06 -0500 |
| Message-ID | <jf9822$hhd$1@dont-email.me> |
| In reply to | #4518 |
On 1/19/2012 7:39 AM, Arno Welzel wrote: > Arno Welzel, 2012-01-19 13:36: > >> Jerry Stuckle, 2012-01-17 14:16: >> >>> On 1/17/2012 12:59 AM, Arno Welzel wrote: >>>> Jerry Stuckle, 2012-01-16 14:45: >>>> >>>>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>>>> lb wrote: >>>>>>> jstucklex@attglobal.net wrote: >>>>>>>> ... >>>>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>>>> converts this correctly to 0. >>>>>> >>>>>> Looks like Jerry doesn't know what an integer is either. >>>>>> >>>>>> A hex number of course *is* an integer, unless its a hex representation >>>>>> of floating point. >>>>>> >>>>>> Killfile the prat like I have. >>>>>> >>>>>> >>>>> >>>>> 0x12 is not an integer. It is a hexadecimal value. >>>> >>>> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >>>> value 18. There is no thing like "hexadecimal value" and "0x12" is a >>>> *string* and not a number at all. >>>> >>> >>> No, it is a hexadecimal value. It may be an integer, it may be a >>> character, it may be a set of flags... It does not have to be an integer. >>> >>>> In fact PHP only knows to types of numbers: integers and floating point. >>>> There is no "hexadecimal" data type. >>>> >>> >>> Excuse me - there is. See hexdec(). >> >> <http://php.net/manual/en/function.hexdec.php> >> >> You don't know what a data type is? Do you? >> >> See<http://www.php.net/manual/en/language.types.php> and show me, where >> the "hexadecimal data type" is explained. > > And you should read the section about *integer* literal in > <http://www.php.net/manual/en/language.types.integer.php> very carefully. > > There is no thing as "conversion of hexadecimal values to an integer". > > EOD for me. > > That's good. Come on back when you learn to read. '0x12' is not an integer. But then you've already proven you have no idea what you're talking about. All you're doing is making yourself look even stoopider. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-19 09:05 -0500 |
| Message-ID | <jf97vc$hpi$1@dont-email.me> |
| In reply to | #4517 |
On 1/19/2012 7:36 AM, Arno Welzel wrote: > Jerry Stuckle, 2012-01-17 14:16: > >> On 1/17/2012 12:59 AM, Arno Welzel wrote: >>> Jerry Stuckle, 2012-01-16 14:45: >>> >>>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>>> lb wrote: >>>>>> jstucklex@attglobal.net wrote: >>>>>>> ... >>>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>>> converts this correctly to 0. >>>>> >>>>> Looks like Jerry doesn't know what an integer is either. >>>>> >>>>> A hex number of course *is* an integer, unless its a hex representation >>>>> of floating point. >>>>> >>>>> Killfile the prat like I have. >>>>> >>>>> >>>> >>>> 0x12 is not an integer. It is a hexadecimal value. >>> >>> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >>> value 18. There is no thing like "hexadecimal value" and "0x12" is a >>> *string* and not a number at all. >>> >> >> No, it is a hexadecimal value. It may be an integer, it may be a >> character, it may be a set of flags... It does not have to be an integer. >> >>> In fact PHP only knows to types of numbers: integers and floating point. >>> There is no "hexadecimal" data type. >>> >> >> Excuse me - there is. See hexdec(). > > <http://php.net/manual/en/function.hexdec.php> > > You don't know what a data type is? Do you? > > See<http://www.php.net/manual/en/language.types.php> and show me, where > the "hexadecimal data type" is explained. > > m( > > Learn to read. I never said anything about a hexadecimal datatype. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2012-01-19 15:01 +0000 |
| Message-ID | <jf9b91$spv$2@news.albasani.net> |
| In reply to | #4517 |
Arno Welzel wrote: > Jerry Stuckle, 2012-01-17 14:16: > >> On 1/17/2012 12:59 AM, Arno Welzel wrote: >>> Jerry Stuckle, 2012-01-16 14:45: >>> >>>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>>> lb wrote: >>>>>> jstucklex@attglobal.net wrote: >>>>>>> ... >>>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>>> converts this correctly to 0. >>>>> Looks like Jerry doesn't know what an integer is either. >>>>> >>>>> A hex number of course *is* an integer, unless its a hex representation >>>>> of floating point. >>>>> >>>>> Killfile the prat like I have. >>>>> >>>>> >>>> 0x12 is not an integer. It is a hexadecimal value. >>> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >>> value 18. There is no thing like "hexadecimal value" and "0x12" is a >>> *string* and not a number at all. >>> >> No, it is a hexadecimal value. It may be an integer, it may be a >> character, it may be a set of flags... It does not have to be an integer. >> >>> In fact PHP only knows to types of numbers: integers and floating point. >>> There is no "hexadecimal" data type. >>> >> Excuse me - there is. See hexdec(). > > <http://php.net/manual/en/function.hexdec.php> > > You don't know what a data type is? Do you? > No, it's Jerrykins. You expect too much....... > See <http://www.php.net/manual/en/language.types.php> and show me, where > the "hexadecimal data type" is explained. > .......Including the ability to say 'er yes, I was wrong' with grace, or at all. > m( > >
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2012-01-19 14:41 -0500 |
| Message-ID | <jf9rl7$bs3$2@dont-email.me> |
| In reply to | #4527 |
On 1/19/2012 10:01 AM, The Natural Philosopher wrote: > Arno Welzel wrote: >> Jerry Stuckle, 2012-01-17 14:16: >> >>> On 1/17/2012 12:59 AM, Arno Welzel wrote: >>>> Jerry Stuckle, 2012-01-16 14:45: >>>> >>>>> On 1/16/2012 8:28 AM, The Natural Philosopher wrote: >>>>>> lb wrote: >>>>>>> jstucklex@attglobal.net wrote: >>>>>>>> ... >>>>>>>> No, it is not. '0x12' is a hex number, not an integer. (int)'0x12' >>>>>>>> converts this correctly to 0. >>>>>> Looks like Jerry doesn't know what an integer is either. >>>>>> >>>>>> A hex number of course *is* an integer, unless its a hex >>>>>> representation >>>>>> of floating point. >>>>>> >>>>>> Killfile the prat like I have. >>>>>> >>>>>> >>>>> 0x12 is not an integer. It is a hexadecimal value. >>>> No, 0x12 (and *not* "0x12") is the hexadecimal *representation* of the >>>> value 18. There is no thing like "hexadecimal value" and "0x12" is a >>>> *string* and not a number at all. >>>> >>> No, it is a hexadecimal value. It may be an integer, it may be a >>> character, it may be a set of flags... It does not have to be an >>> integer. >>> >>>> In fact PHP only knows to types of numbers: integers and floating >>>> point. >>>> There is no "hexadecimal" data type. >>>> >>> Excuse me - there is. See hexdec(). >> >> <http://php.net/manual/en/function.hexdec.php> >> >> You don't know what a data type is? Do you? >> > > No, it's Jerrykins. > > You expect too much....... > >> See <http://www.php.net/manual/en/language.types.php> and show me, where >> the "hexadecimal data type" is explained. >> > > .......Including the ability to say 'er yes, I was wrong' with grace, or > at all. > > >> m( >> >> Another troll who can't read. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web