{"id":21,"date":"2020-08-24T14:21:02","date_gmt":"2020-08-24T06:21:02","guid":{"rendered":"http:\/\/9iwd.top\/?p=21"},"modified":"2020-08-24T14:21:02","modified_gmt":"2020-08-24T06:21:02","slug":"no-7%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b","status":"publish","type":"post","link":"http:\/\/9iwd.top\/?p=21","title":{"rendered":"No.7\u6570\u636e\u7c7b\u578b"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/* \n#\u6570\u636e\u7c7b\u578b\n\n\u6570\u636e\u7c7b\u578b: data type,\u5728PHP\u4e2d\u6307\u7684\u662f\u5b58\u50a8\u7684\u6570\u636e\u672c\u8eab\u7684\u7c7b\u578b\uff0c\u800c\u4e0d\u662f\u53d8\u91cf\u7684\u7c7b\u578b\u3002PHP\u662f\n\u4e00\u79cd\u5f31\u7c7b\u578b\u8bed\u8a00\uff0c\u53d8\u91cf\u672c\u8eab\u6ca1\u6709\u6570\u636e\u7c7b\u578b\u3002\n.PHP\u7684\u516b\u79cd\u6570\u636e\u7c7b\u578b.\n\u5728PHP\u4e2d\u5c06\u6570\u636e\u5206\u4e3a\u4e09\u5927\u7c7b\u516b\u5c0f\u7c7b:\u3002\n\n\u7b80\u5355(\u57fa\u672c)\u6570\u636e\u7c7b\u578b: 4\u4e2a\u5c0f\u7c7b\u3002\n\u6574\u578b: int\/integer, \u7cfb\u7edf\u5206\u914d4\u4e2a\u5b57\u8282\u5b58\u50a8\uff0c\u8868\u793a\u6574\u6570\u7c7b\u578b(\u6709\u524d\u63d0)\u3002\n\u6d6e\u70b9\u578b: float\/double\uff0c \u7cfb\u7edf\u5206\u914d8\u4e2a\u5b57\u8282\u5b58\u50a8\uff0c\u8868\u793a\u5c0f\u6570\u6216\u8005\u6574\u578b\u5b58\u4e0d\u4e0b\u7684\u6574\u6570\n\u5b57\u7b26\u4e32\u578b: string, \u7cfb\u7edf\u6839\u636e\u5b9e\u9645\u957f\u5ea6\u5206\u914d\uff0c\u8868\u793a\u5b57\u7b26\u4e32(\u5f15\u53f7)\u3002\n\u5e03\u5c14\u7c7b\u578b: bool\/boolean, \u8868\u793a\u5e03\u5c14\u7c7b\u578b\uff0c\u53ea\u6709\u4e24\u4e2a\u503c: true \u548cfalsee\n\n\u590d\u5408\u6570\u636e\u7c7b\u578b: 2\u4e2a\u5c0f\u7c7b\n\u5bf9\u8c61\u7c7b\u578b: object, \u5b58\u653e\u5bf9\u8c61(\u9762\u5411\u5bf9\u8c61)\n\u6570\u7ec4\u7c7b\u578b:array\uff0c\u5b58\u50a8\u591a\u4e2a\u6570\u636e(\u4e00\u6b21\u6027)\n\n\u7279\u6b8a\u6570\u636e\u7c7b\u578b: 2\u4e2a\u5c0f\u7c7b\u3002\n\u8d44\u6e90\u7c7b\u578b: resource, \u5b58\u653e\u8d44\u6e90\u6570\u636e(PHP \u5916\u90e8\u6570\u636e\uff0c\u5982\u6570\u636e\u5e93\u3001\u6587\u4ef6)\u3002\n\u7a7a\u7c7b\u578b: NULL\uff0c \u53ea\u6709-\u4e00\u4e2a\u503c\u5c31\u662fNULL (\u4e0d\u80fd\u8fd0\u7b97)\u3002\n*\/<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\n#\u7c7b\u578b\u8f6c\u6362\n\n\u7c7b\u578b\u8f6c\u6362:\u5728\u5f88\u591a\u7684\u6761\u4ef6\u4e0b\uff0c\u9700\u8981\u6307\u5b9a\u7684\u6570\u636e\u7c7b\u578b\uff0c\u9700\u8981\u5916\u90e8\u6570\u636e(\u5f53\u524dPHP\u53d6\u5f97\u7684\u6570\u636e),\n\u8f6c\u6362\u6210\u76ee\u6807\u6570\u636e\u7c7b\u578b\u3002\n\u5728PHP\u4e2d\u6709\u4e24\u79cd\u7c7b\u578b\u8f6c\u6362\u65b9\u5f0f:\u3002\n1\u3001\u81ea\u52a8\u8f6c\u6362:\u7cfb\u7edf\u6839\u636e\u9700\u6c42\u81ea\u5df1\u5224\u5b9a\uff0c\u81ea\u5df1\u8f6c\u6362(\u7528\u7684\u6bd4\u8f83\u591a\uff0c\u6548\u7387\u504f\u4f4e)\n2\u3001\u5f3a\u5236(\u624b\u52a8)\u8f6c\u6362:\u8ba4\u4e3a\u6839\u636e\u9700\u8981\u7684\u76ee\u6807\u7c7b\u578b\u8f6c\u6362\n\u5f3a\u5236\u8f6c\u6362\u89c4\u5219\uff1a\u5728\u53d8\u91cf\u4e4b\u524d\u589e\u52a0\u4e00\u4e2a(),\u7136\u540e\u5728\u91cc\u9762\u5199\u4e0a\u5bf9\u5e94\u5f97\u7c7b\u578b\uff1aint\/integer...\n\u5176\u4e2dNULL\u7c7b\u578b\u7528\u5230 unset()\u51fd\u6570\n\n\u5728\u8f6c\u6362\u8fc7\u7a0b\u4e2d\uff0c\u7528\u7684\u6bd4\u8f83\u591a\u7684\u5c31\u662f\u8f6c\u5e03\u5c14\u7c7b\u578b(\u5224\u65ad)\u548c\u8f6c\u6570\u503c\u7c7b\u578b(\u7b97\u672f\u8fd0\u7b97)\n\u5176\u4ed6\u7c7b\u578b\u8f6c\u5e03\u5c14\u7c7b\u578b: true \u6216\u8005false, \u5728PHP\u4e2d\u6bd4\u8f83\u5c11\u7c7b\u578b\u6362\u53d8\u6210falsey\n\n\u5176\u4ed6\u7c7b\u578b\u8f6c\u6570\u503c\u7684\u8bf4\u660e\n1\u3001\u5e03\u5c14true\u4e3a1,false\u4e3a0;\u3002\n2\u3001\u5b57\u7b26\u4e32\u8f6c\u6570\u503c\u6709\u81ea\u5df1\u7684\u89c4\u5219\n2.1\u4ee5\u5b57 \u6bcd\u5f00\u5934\u7684\u5b57\u7b26\u4e32\uff0c\u6c38\u8fdc\u4e3a0;\n2.2\u4ee5\u6570\u5b57\u5f00\u5934\u7684\u5b57\u7b26\u4e32\uff0c\u53d6\u5230\u78b0\u5230\u5b57\u7b26\u4e32\u4e3a\u6b62(\u4e0d\u4f1a\u540c\u65f6\u5305\u542b\u4e24\u4e2a\u5c0f\u6570\u70b9)\u3002\n*\/\n\n\/\/\u521b\u5efa\u6570\u636e\n$a='asd1.1.1';\n$s='1.1.1asd';\n\n\n\/\/\u81ea\u52a8\u8f6c\u6362\necho $a+$s;\n\necho '&lt;br\/>';\n\/\/\u5f3a\u5236\u8f6c\u6362\necho (float)$a,(float)$s;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* \n#\u7c7b\u578b\u5224\u65ad\n\n\u901a\u8fc7\u4e00\u7ec4\u7c7b\u578b\u5224\u65ad\u51fd\u6570\uff0c\u6765\u5224\u65ad\u53d8\u91cf\uff0c\u6700\u7ec8\u8fd4\u56de\u8fd9\u4e2a\u53d8\u91cf\u6240\u4fdd\u5b58\u6570\u636e\u7684\u6570\u636e\u7c7b\u578b(\u76f8\u540c\u7ed3\u679c\n\u4e3atrue,\u5931\u8d25\u4e3afalse):\u662f\u4e00\u7ec4\u4ee5is_\u5f00\u5934\u540e\u9762\u8ddf\u7c7b\u578b\u540d\u5b57\u7684\u51fd\u6570: is XXX(\u53d8\u91cf\u540d)\nBool\u7c7b\u578b\u4e0d\u80fd\u7528echo\u6765\u67e5\u770b\uff0c\u53ef\u4ee5\u4f7f\u7528var. dump\u7ed3\u6784\u67e5\u770b\u3002\nVar_dump(\u53d8\u91cf1,\u53d8\u91cf2...)\n*\/\n\necho '&lt;hr\/>';\nvar_dump(is_int($a));\t\t\/\/\u5224\u65ad\u662f\u5426\u4e3a\u6574\u6570\u53d8\u91cf\nvar_dump(is_string($a));\t\/\/\u5224\u65ad\u662f\u5426\u4e3a\u5b57\u7b26\u4e32\u53d8\u91cf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\/* \n#\u53d8\u91cf\u7c7b\u578b\u83b7\u53d6\/\u6539\u53d8\u7c7b\u578b\n\n\u8fd8\u6709\u4e00\u7ec4\u51fd\u6570\u53ef\u4ee5\u7528\u6765\u83b7\u53d6\u4ee5\u53ca\u8bbe\u5b9a\u6570\u636e(\u53d8\u91cf)\u7684\u7c7b\u578bs \nGettype(\u53d8\u91cf\u540d):\u83b7\u53d6\u7c7b\u578b\uff0c\u5f97\u5230\u7684\u662f\u8be5\u7c7b\u578b\u5bf9\u5e94\u7684\u5b57\u7b26\u4e32\u3002\nSettype(\u53d8\u91cf\u540d,\u7c7b\u578b):\u8bbe\u5b9a\u6570\u636e\u7c7b\u578b:\u4e0e\u5f3a\u5236\u8f6c\u6362\u4e0d\u540c\u3002\n1\u3001\u5f3a\u5236\u8f6c\u6362(\u7c7b\u578b)\u53d8\u91cf\u540d\uff0c\u662f\u5bf9\u6570\u636e\u503c\u590d\u5236\u7684\u5185\u5bb9\u8fdb\u884c\u5904\u7406(\u4e0d\u4f1a\u5904\u7406\u5b9e\u9645\u5b58\u50a8\u7684\u5185\u5bb9)\u3002\n2\u3001settype. \u4f1a\u76f4\u63a5\u6539\u53d8\u6570\u636e\u672c\u8eab\u3002\n *\/\n#\u53d6\u53d8\u91cf\u7c7b\u578b\necho '&lt;br\/>';\necho Gettype($a);\t\t\t\t\/\/\u83b7\u53d6\u8f93\u51fa\u672c\u8eab\u53d8\u91cf\u7684\u7c7b\u578b\n\n#\u6539\u53d8\u7c7b\u578b\/\u8bbe\u7f6e\u7c7b\u578b\necho '&lt;br\/>';\nvar_dump(Settype($s,'double'));\t\/\/\u5224\u65ad\u6539\u53d8\u53d8\u91cf\u662f\u5426\u6210\u529f\necho Gettype($s),$s;\t\t\t\/\/\u8f93\u51fa\u6539\u53d8\u540e\u7684\u53d8\u91cf\u7c7b\u578b \u548c \u6539\u53d8\u540e\u7684\u53d8\u91cf\u6570\u636e\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[3],"_links":{"self":[{"href":"http:\/\/9iwd.top\/index.php?rest_route=\/wp\/v2\/posts\/21"}],"collection":[{"href":"http:\/\/9iwd.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/9iwd.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/9iwd.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/9iwd.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21"}],"version-history":[{"count":0,"href":"http:\/\/9iwd.top\/index.php?rest_route=\/wp\/v2\/posts\/21\/revisions"}],"wp:attachment":[{"href":"http:\/\/9iwd.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/9iwd.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/9iwd.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}