PHP ã®è¨èªä»æ§ã¯ãã©ã³ã¿ã¤ã ã®ã³ã³ãã¤ã«ç°å¢ã«ä¾åãã¾ãã
å人çã«ã¯ãPHP ã£ã¦ãå«ããªè¨èªãããªããã ãã©ãã¨ããå®ææ¦äºã«æã¡è¾¼ã¾ãããããæ»æããå´ã¯ããè¨èªã¨ãã¦ãªã£ã¨ãããã¿ãããªä¸»å¼µãå¤ãã¦ãå ·ä½çã«ã©ããï¼ ã¨æã£ã¦ãããã ãã©ãããã»ã©é¢ç½ãä¾ã¯ç¡ãã
ã16 é²æ°ã®è¡¨è¨ã¯æ´æ°ã«å¤æãããã©ãããããï¼é²æ°ã¯ãã¨ãã辺ããåä½ãªã®ã ãããã®æåãçµæ§ã奥ãæ·±ãã£ãã
PHPでは"0x0A"=="10"がtrue | 水無月ばけらのえび日記
ä¸è¨ãã¼ã¸ãèªãã¨ãæ´æ°ã«å¤æãããã©ããã¯ãC ã®ã©ã¤ãã©ãªé¢æ°ã§ãã strtod ã«ä¾åãã¦ããããããã§ããã®ãã¼ã¸ã®ã³ã¡ã³ãã«æ¸ããã¦ããããã«ããã® strtod èªä½ããã³ã³ãã¤ã©ãã©ã®è¦æ ¼ã«æºæ ãã¦ã³ã³ãã¤ã«ãããã«ãã£ã¦ãæåãå¤ãã£ã¦ãã¾ããC99 æºæ ãã¦ã³ã³ãã¤ã«ããã°ã16 é²æ°ã®è¡¨è¨ã¯æ´æ°ã«å¤æãããããããã§ãªããã°å¤æãããªãã
ã¨ãªãã¨ãå ã®ã"0x0A"=="10"ãã true ã false ãã¯ã
PHP èªä½ãã©ããã«ãããã
ã«ãã£ã¦ãçããå¤ãã£ã¦ãã¾ããã¨ã«ãªããã¤ã¾ããè¨èªã¨ãã¦ã¯ã
ã"0x0A"=="10"ãã®çµæã¯ä¸å®
ã¨ãããã¨ã«ãªãã
PHP æ¯ææ´¾ã®äººã¯ãã=== ã使ãã¹ããã¨è¨ã£ã¦ããããããã¯æååã¨ãã¦æ¯è¼ããããã¨ããæ確ãªæå³ãæã£ã¦æ¯è¼ããå ´åã®åé¿çã§ãããã"0x0A"=="10"ãã true ã¨ãªãäºãæå¾ ããã³ã¼ãæ¸ãã¦ããå ´åãã¤ã¾ãã
- å¤æ°ã«æååãæ ¼ç´ãã
- æ°å¤ã®æåå表ç¾ã¨ã㦠16 é²æ°ã許容ãã
- æ°å¤ã¨ãã¦æ¯è¼ããã
ã¨ããå ´åãæå¾ ããåä½ã«ãªããã©ããã¯ãå®è¡ç°å¢ã«ä¾åãããã¨ã«ãªããããããã"0x0A"=="10"ãã¯ã大é¨åã® Linux ã§ã¯ true ã¨ãªãäºãæå¾ ã§ããããåç¨ UNIX ã 㨠false ã«ãªãå¯è½æ§ãé«ã*1ãLinux ã ã£ã¦ãã³ã³ãã¤ã«ãªãã·ã§ã³ã§ãããã¦ãæºæ ããè¦æ ¼ãä¸ãã¦ãã³ã³ãã¤ã«ããããfalse ã«ãªããPHP æ¬ä½ã®ãã¼ã¸ã§ã³ã§ããªããåä½ OS ã§ããªãããã³ã³ãã¤ã«ããæãã©ãã ã£ãããã§æåãå¤ãããã¨ããã®ã¯ããããã«é ·ãã
ãããè¦ããããPHP ãããã·ã¥ã¨é åãåºå¥ãã¦ããªãã®ã¯æ°æã¡æªãããªãã¦ã®ã¯ã©ãã§ããããããã¯ãè¨èªã¨ãã¦ã®ææ³ãªãã ããããã㧠PHP ãæ¹å¤ããã®ã¯å®ææ¦äºã«ãããªããªããã§ãããã®æ¯è¼ã®ä»¶ã¯ãå®è¡ç°å¢ã«ãã£ã¦å ¨ãå対ã®çãã«ãªã£ã¦ãã¾ããã¨ããã®ã ããããã¡ãæªãã
極端ãªãã¨ãè¨ãã°ãPHP ãã¡ããã¨åå¼·ãããã£ãããC è¨èªã®è¦æ ¼ã«ã詳ãããªãããæ£ããã³ã¼ãã¯æ¸ããªããã¨ããã®ã ãã...ã
PHP ã®ãæ軽ããã¨ããã®ã¯èªåãç¥ã£ã¦ããã®ã§ããã㧠PHP ãå ¨é¨å¦å®ãããããªãã¨ã¯ãå人çã«ã¯å ¨ãæããªãããæ¥é è¨ããã¦ããããPHP ã¯ããå æ¸ãã¨ããäºãäºå®ããããã¨ã¯ãããã§åãã£ãã
*1:ãã¾ãã¾ããã®æ¥è¨ã®ã¯ã¦ããè¦ãããã©ãã®åç¨ UNIX ã ãã¨ããã®ããã£ãããHP-UX ã®ç´æ£ã³ã³ãã¤ã©ã§ C99 ä»æ§ã«ããããã«ã¯ãã³ã³ãã¤ã«ãªãã·ã§ã³ã§æå®ããå¿ è¦ãããï¼http://docs.hp.com/ja/5991-4870/ch01s07.html#bgbgacdaï¼ãä»æã® Linux ã«ä»ãã¦ãã gcc ãªãããã©ã«ã㧠C99 ã¨ãã¦ã³ã³ãã¤ã«ããã®ã§ãLinux ä¸ã§ round() ã使ã£ã¦ã㦠ãã®ã³ã¼ãã HP-UX ä¸ã¸æã£ã¦ããã¨ãã«ãã«å¤±æãã¨ããã®ãæè¿ãã£ãï¼round() é¢æ°ã¯ C99 ã§è¿½å ããããã®ï¼ããã¡ãããã³ã³ãã¤ã«æã« -AC99 ãæå®ããããgcc ãæã£ã¦ããã°è¯ãã®ã ããæèãã¦ããªã㨠C89 ã§ã³ã³ãã¤ã«ããããã¨ã«ãªãã