{"id":426,"date":"2017-08-11T08:44:27","date_gmt":"2017-08-10T23:44:27","guid":{"rendered":"http:\/\/akamist.com\/blog\/?p=426"},"modified":"2017-10-11T22:54:00","modified_gmt":"2017-10-11T13:54:00","slug":"phpstrpos%e9%96%a2%e6%95%b0%e3%81%a7%e3%80%81empty-needle-in-%e3%81%aephp-warning%e3%81%8c%e5%87%ba%e5%8a%9b%e3%81%95%e3%82%8c%e3%82%8b%e6%9d%a1%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/426","title":{"rendered":"[PHP]strpos()\u95a2\u6570\u3067\u3001Empty needle in... \u306ePHP Warning\u304c\u51fa\u529b\u3055\u308c\u308b\u6761\u4ef6"},"content":{"rendered":"<p>PHP\u3067strpos()\u95a2\u6570\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u3001\u4e0b\u8a18\u306e\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">PHP Warning:  strpos(): Empty needle in...\n<\/code><\/pre>\n<p>\u3053\u308c\u306f\u3001strpos()\u306e\u7b2c\u4e8c\u5f15\u6570\u304c\u3001\u7a7a\u6587\u5b57\u5217\u306e\u3068\u304d\u306b\u767a\u751f\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<h2>Warning\u51fa\u529b\u306e\u518d\u73fe\u30b3\u30fc\u30c9<\/h2>\n<pre><code class=\"language-php\">&lt;?php\n$data = 'abracadabra';\n\n$pos = strpos($data, 'bra');    \/\/ \u3053\u308c\u306f\u5927\u4e08\u592b(\u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044)\necho $pos . PHP_EOL;            \/\/ 1\n\n$pos = strpos($data, '');       \/\/ \u30a8\u30e9\u30fc\u304c\u767a\u751f: PHP Warning:  strpos(): Empty needle in...\necho $pos . PHP_EOL;\n<\/code><\/pre>\n<h2>Warning\u304c\u51fa\u529b\u3055\u308c\u305d\u3046\u3067\u3001\u5b9f\u306f\u51fa\u529b\u3055\u308c\u306a\u3044\u30d1\u30bf\u30fc\u30f3<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u306f\u4e00\u898b\u3059\u308b\u3068Warning\u304c\u51fa\u305d\u3046\u3067\u3059\u304c\u3001Warning\u306f\u8868\u793a\u3055\u308c\u307e\u305b\u3093\u3002<br \/>\n\u30c0\u30e1\u306a\u306e\u306f\u3001\u7a7a\u6587\u5b57\u5217\u306e\u6642\u3060\u3051\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<pre><code class=\"language-php\">&lt;?php\n$data = 'abracadabra';\n$pos = strpos($data, null);    \/\/ \u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\nvar_dump($pos);                 \/\/ bool(false)\n\n$pos = strpos($data, false);    \/\/ \u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\nvar_dump($pos);                 \/\/ bool(false)\n\n$pos = strpos($data, 0);        \/\/ \u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044\nvar_dump($pos);                 \/\/ bool(false)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP\u3067strpos()\u95a2\u6570\u3092\u5b9f\u884c\u3057\u305f\u3068\u304d\u3001\u4e0b\u8a18\u306e\u8b66\u544a\u304c\u8868\u793a\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 PHP Warning: strpos(): Empty needle in... \u3053\u308c\u306f\u3001strpos()\u306e\u7b2c\u4e8c\u5f15\u6570\u304c\u3001\u7a7a\u6587\u5b57\u5217\u306e\u3068\u304d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":730,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2017\/10\/icon_php.png","jetpack-related-posts":[{"id":365,"url":"https:\/\/akamist.com\/blog\/archives\/365","url_meta":{"origin":426,"position":0},"title":"PHP\u3067\u3082range()\u95a2\u6570\u3092\u4f7f\u3063\u3066\u307f\u3088\u3046","date":"2017\u5e748\u67081\u65e5","format":false,"excerpt":"python\u3067\u306f\u4e00\u5b9a\u306e\u56de\u6570\u30eb\u30fc\u30d7\u3055\u305b\u305f\u308a\u3001\u4e00\u5b9a\u306e\u7bc4\u56f2\u306e\u6570\u5217\u3092\u6271\u3046\u305f\u3081\u306b\u3001range()\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\u2026","rel":"","context":"PHP","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/10\/icon_php.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3447,"url":"https:\/\/akamist.com\/blog\/archives\/3447","url_meta":{"origin":426,"position":1},"title":"[PHP]\u30e6\u30fc\u30b6\u540d\u306a\u3069\u306e\u6587\u5b57\u5217\u304b\u3089\u9069\u5207\u306a\u30ab\u30e9\u30fc\u3092\u81ea\u52d5\u3067\u751f\u6210\u3059\u308b","date":"2018\u5e7412\u67082\u65e5","format":false,"excerpt":"\u8907\u6570\u306e\u30c7\u30fc\u30bf\u3092\u6271\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f5c\u308b\u6642\u3001\u5404\u30c7\u30fc\u30bf\u7cfb\u5217\u3054\u3068\u306b\u9069\u5207\u306a\u8272\u3092\u5272\u308a\u5f53\u3066\u3066\u8868\u793a\u3055\u305b\u305f\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u2026","rel":"","context":"PHP","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/12\/3447.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":596,"url":"https:\/\/akamist.com\/blog\/archives\/596","url_meta":{"origin":426,"position":2},"title":"[PHP]Slim3\u3067\u306f\u3001\u306a\u305cget()\u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067$this\u3067DI\u30b3\u30f3\u30c6\u30ca\u304c\u53d6\u5f97\u3067\u304d\u308b\u304b?","date":"2017\u5e749\u670815\u65e5","format":false,"excerpt":"PHP\u306eSlim3 Framework\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067get\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u8d70\u3063\u305f\u6642\u306e\u30b3\u30fc\u30eb\u30d0\u2026","rel":"","context":"SlimFramework","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/08\/icon_slimframework.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2779,"url":"https:\/\/akamist.com\/blog\/archives\/2779","url_meta":{"origin":426,"position":3},"title":"[python]\u5bfe\u6570\u3092\u53d6\u308b\u95a2\u6570math.log()\u3068\u3001\u5bfe\u6570\/\u81ea\u7136\u5bfe\u6570\u3068\u306f\u4f55\u304b\u3092\u76f4\u611f\u7684\u306b\u7406\u89e3\u3059\u308b","date":"2018\u5e745\u670824\u65e5","format":false,"excerpt":"python\u3067\u5bfe\u6570\u3092\u53d6\u308b\u95a2\u6570math.log()\u306e\u4f7f\u3044\u65b9\u3068\u3001\u5bfe\u6570\u81ea\u4f53\u306e\u6982\u5ff5\u306e\u304a\u3055\u3089\u3044\u3067\u3059\u3002 \u7279\u306b\u5bfe\u6570\u2026","rel":"","context":"python","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/05\/icon_python.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":195,"url":"https:\/\/akamist.com\/blog\/archives\/195","url_meta":{"origin":426,"position":4},"title":"[PHP]Composer\u3067\u300cAllowed memory size of x bytes exhausted\u300d\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3068\u304d\u306b\u3059\u308b\u3053\u3068","date":"2017\u5e745\u670826\u65e5","format":false,"excerpt":"PHP\u3067Composer\u3092\u4f7f\u3063\u3066\u3044\u308b\u3068\u3001Allowed memory size of XXXXXX \u2026","rel":"","context":"composer","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/06\/icon_composer2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":6,"url":"https:\/\/akamist.com\/blog\/archives\/6","url_meta":{"origin":426,"position":5},"title":"[PHP]Composer\u3067Autoload\u51fa\u6765\u306a\u3044\u6642\u306e\u78ba\u8a8d\u65b9\u6cd5","date":"2017\u5e745\u67083\u65e5","format":false,"excerpt":"PHP\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u3067\u3042\u308bComposer\u306b\u306f\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u306e\u30aa\u30fc\u30c8\u30ed\u30fc\u30c9\u6a5f\u80fd\u2026","rel":"","context":"composer","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/06\/icon_composer2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/426"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=426"}],"version-history":[{"count":2,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/426\/revisions"}],"predecessor-version":[{"id":428,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/426\/revisions\/428"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media\/730"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}