
{"id":7428,"date":"2023-09-17T01:00:00","date_gmt":"2023-09-16T16:00:00","guid":{"rendered":"https:\/\/tetraup.com\/news_topics\/archives\/7428"},"modified":"2025-07-27T16:11:54","modified_gmt":"2025-07-27T07:11:54","slug":"php-part9","status":"publish","type":"post","link":"https:\/\/tetraup.com\/news_topics\/column\/php-part9\/","title":{"rendered":"\u975e\u30a8\u30f3\u30b8\u30cb\u30a2\u3067\u3082\u77e5\u3089\u306a\u3044\u3068\u30e4\u30d0\u30a4PHP\u3000Part9\u301c\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u3064\u3044\u3066\u7406\u89e3\u3057\u3088\u3046\u301c"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"980\" height=\"700\" src=\"https:\/\/tetraup.com\/news_topics\/wp-content\/uploads\/2023\/09\/\u975e\u30a8\u30f3\u30b8\u30cb\u30a2\u3067\u3082\u77e5\u3089\u306a\u3044\u3068\u30e4\u30d0\u30a4PHP_Part9.jpg\" alt=\"\" class=\"wp-image-9025\"\/><\/figure>\n\n\n\n<p><a href=\"https:\/\/tetraup.com\/news_topics\/column\/php-part8\/\" title=\"\">\u524d\u56de<\/a>\u306fPHP\u306e\u6761\u4ef6\u5206\u5c90\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306fPHP\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u3064\u3044\u3066\u8aac\u660e\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<br><div class=\"wp-block-button\"><a class=\"wp-block-button__link has-very-dark-gray-color has-light-green-cyan-background-color has-text-color has-background wp-element-button\" href=\"https:\/\/tetraup.com\/education\/trial-form\" style=\"border-radius:3px\" target=\"_blank\" rel=\"noreferrer noopener\">\u7121\u6599\u4f53\u9a13\u6388\u696d\u306e\u304a\u7533\u8fbc\u307f\u306f\u30b3\u30c1\u30e9<\/a><\/div><br>\n\n\n\n<h2 class=\"wp-block-heading\">\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3068\u306f<\/h2>\n\n\n\n<p>\u300c<span style=\"color:blue;\"><strong>\u3042\u308b\u6761\u4ef6\u304c\u6e80\u305f\u3055\u308c\u308b\u307e\u3067\u3001\u540c\u3058\u51e6\u7406\u304c\u7e70\u308a\u8fd4\u3057\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406<\/strong><\/span>\u300d\u306e\u3053\u3068\u3092\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\uff08\u30eb\u30fc\u30d7\u51e6\u7406\uff09\u3068\u8a00\u3044\u307e\u3059\u3002PHP\u3067\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u5b9f\u88c5\u3059\u308b\u306b\u306f\u3001\u3044\u304f\u3064\u304b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u5b9f\u88c5\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u5177\u4f53\u7684\u306a\u5b9f\u88c5\u65b9\u6cd5\u3068\u3057\u3066\u3001\u4eca\u56de\u306f\u4ee5\u4e0b\u306e4\u3064\u3092\u3054\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>for\u6587<\/li>\n\n\n\n<li>foreach\u6587<\/li>\n\n\n\n<li>while\u6587<\/li>\n\n\n\n<li>do{ }while( )\u6587<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">for\u6587<\/h3>\n\n\n\n<p>for\u6587\u306f\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u57fa\u672c\u3068\u306a\u308b\u69cb\u6587\u3067\u3059\u3002\u66f8\u304d\u65b9\u306f\u4ee5\u4e0b\u306e\u69d8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\nfor(\u958b\u59cb\u6761\u4ef6 ; \u7d99\u7d9a\u6761\u4ef6 ; \u7e70\u308a\u8fd4\u3057\u51e6\u7406\u7d42\u4e86\u5f8c\u306e\u6761\u4ef6\u5909\u66f4){\n  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406 ;\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\">(\u958b\u59cb\u6761\u4ef6 ; \u7d99\u7d9a\u6761\u4ef6 ; \u7e70\u308a\u8fd4\u3057\u51e6\u7406\u7d42\u4e86\u5f8c\u306e\u6761\u4ef6\u5909\u66f4){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406 ;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>for\u6587\u306e( )\u306e\u4e2d\u306e\u533a\u5207\u308a\u306b\u306f\u300c;\uff08\u534a\u89d2\u30bb\u30df\u30b3\u30ed\u30f3\uff09\u300d\u3092\u7528\u3044\u307e\u3059\u3002\u3053\u308c\u3060\u3051\u3060\u3068\u975e\u5e38\u306b\u308f\u304b\u308a\u3065\u3089\u3044\u3068\u601d\u3046\u306e\u3067\u3001\u5177\u4f53\u4f8b\u3092\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\nfor($i = 1 ; $i &lt;= 3 ; $i++){\n  print($i);\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$i<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\"> ; <\/span><span style=\"color: #9CDCFE\">$i<\/span><span style=\"color: #D4D4D4\"> &lt;= <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\"> ; <\/span><span style=\"color: #9CDCFE\">$i<\/span><span style=\"color: #D4D4D4\">++){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$i<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3067\u306f\u300c1 2 3\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u305d\u308c\u305e\u308c\u8aac\u660e\u3057\u307e\u3059\u3002<br><br>\u958b\u59cb\u6761\u4ef6\uff1a$i = 1<br>\u5909\u6570i\u306b1\u3092\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306e\u5909\u6570\u306b\u306fi\u304c\u4f7f\u7528\u3055\u308c\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002\u8af8\u8aac\u3042\u308a\u307e\u3059\u304c\u3001\u3053\u306ei\u306f\u300cinteger\uff08\u6574\u6570\uff09\u300d\u3084\u300cindex\uff08\u7d22\u5f15\u30fb\u76ee\u76db\u308a\uff09\u300d\u306e\u982d\u6587\u5b57\u3092\u8868\u3057\u3066\u3044\u307e\u3059\u3002\u4eca\u56de\u306e\u958b\u59cb\u6761\u4ef6\u306f1\u3068\u3057\u307e\u3057\u305f\u3002<br><br>\u7d99\u7d9a\u6761\u4ef6\uff1a$i &lt;= 3<br>\u5909\u6570i\u304c3\u4ee5\u4e0b\u3092\u8868\u3057\u307e\u3059\u3002\u5909\u6570i\u304c3\u3092\u8d85\u3048\u306a\u3044\u9650\u308a\u3001{}\u5185\u306e\u51e6\u7406\u306f\u7e70\u308a\u8fd4\u3055\u308c\u307e\u3059\u3002<br><br>\u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\uff1aprint($i)<br>\u5909\u6570i\u3092print\u95a2\u6570\u3067\u51fa\u529b\u3057\u3066\u3044\u307e\u3059\u3002<br><br>\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u7d42\u4e86\u5f8c\u306e\u6761\u4ef6\u5909\u66f4\uff1a$i++<br>\u5909\u6570i\u306b\u300c1\u3092\u52a0\u3048\u308b\u300d\u3068\u3044\u3046\u6761\u4ef6\u304c\u52a0\u308f\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u306e++\u306e\u90e8\u5206\u3067\u3059\u304c<br>$i = $i + 1\uff08\u5909\u6570\u3078\u306e\u518d\u4ee3\u5165\uff1a<a href=\"https:\/\/tetraup.com\/news_topics\/column\/php-part5\/\" title=\"\">\u3053\u3061\u3089<\/a>\u3092\u3054\u53c2\u7167\uff09<br>\u3084<br>$i += 1\uff08\u4e0a\u306e\u5f0f\u3092\u7701\u7565\u5316\u3057\u305f\u66f8\u304d\u65b9\uff09<br>\u3068\u540c\u3058\u3067\u3059\u3002<br><br>\u5f93\u3063\u3066\u3001$ = 3\u306b\u52a0\u7b97\u3055\u308c\u308b\u307e\u3067\u306f\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306f\u5b9f\u65bd\u3055\u308c\u307e\u3059\u3002<span style=\"color:blue;\">$i++\u3092\u5b9f\u884c\u3057\u3066$ = 4\u306b\u306a\u3063\u305f\u6642\u306b\u521d\u3081\u3066\u7d99\u7d9a\u6761\u4ef6\u306b\u5408\u81f4\u3057\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/span>{}\u306e\u4e2d\u306e\u51e6\u7406\u306f\u5b9f\u65bd\u3055\u308c\u305a\u3001\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u7d42\u4e86\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">foreach\u6587\uff08\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u306a\u3044\u5834\u5408\uff09<\/h3>\n\n\n\n<p>foreach\u6587\u306f\u3001\u914d\u5217\uff08\u914d\u5217\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/tetraup.com\/news_topics\/column\/php-part7\/\" title=\"\">\u3053\u3061\u3089<\/a>\u3092\u3054\u53c2\u7167\uff09\u306b\u5bfe\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u306a\u308a\u307e\u3059\u3002foreach\u6587\u304c\u4f7f\u7528\u3067\u304d\u308b\u306e\u306f\u3001\u914d\u5217\u3068\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u306a\u308a\u307e\u3059\u3002\u4ed6\u306e\u30c7\u30fc\u30bf\u578b\u306b\u7528\u3044\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002\u66f8\u304d\u65b9\u306f\u4ee5\u4e0b\u306e\u69d8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$array = [\u50241, \u50242, \u50243];\nforeach($array(\u914d\u5217\u306e\u5909\u6570\u540d) as $value(\u914d\u5217\u5185\u306e\u8981\u7d20)){\n  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406;\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$array<\/span><span style=\"color: #D4D4D4\"> = [\u50241, \u50242, \u50243];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">foreach<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$array<\/span><span style=\"color: #D4D4D4\">(\u914d\u5217\u306e\u5909\u6570\u540d) as <\/span><span style=\"color: #9CDCFE\">$value<\/span><span style=\"color: #D4D4D4\">(\u914d\u5217\u5185\u306e\u8981\u7d20)){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u5148\u307b\u3069\u306efor\u6587\u3068\u7570\u306a\u308b\u306e\u306f\u3001\u914d\u5217\u306e\u5909\u6570\u3092\u7528\u610f\u3057\u3066\u3044\u308b\u3053\u3068\u3001()\u5185\u306b\u914d\u5217\u306e\u5909\u6570\u540d\u3092\u5165\u308c\u308b\u3053\u3068\u3001\u914d\u5217\u5185\u306e\u8981\u7d20\uff08$value\u306e\u90e8\u5206\u3001\u540d\u79f0\u306f\u81ea\u7531\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059\uff09\u306b\u5bfe\u3057\u3066\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u884c\u308f\u308c\u308b\u3053\u3068\u3067\u3059\u3002\u5177\u4f53\u7684\u306b\u307f\u3066\u3044\u304d\u307e\u3057\u3088\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$fruits = [&quot;\u308a\u3093\u3054&quot; , &quot;\u307f\u304b\u3093&quot; , &quot;\u30d0\u30ca\u30ca&quot;];\nforeach($fruits as $fruit){\n  print(&quot;\u597d\u304d\u306a\u679c\u7269\u306f&quot; . $fruit . &quot;\u3067\u3059\u3002&quot;);\n  print(&quot;\u4eca\u65e5\u306f&quot; . $fruit . &quot;\u3092\u98df\u3079\u307e\u3057\u305f\u3002&quot;);\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$fruits<\/span><span style=\"color: #D4D4D4\"> = [<\/span><span style=\"color: #CE9178\">&quot;\u308a\u3093\u3054&quot;<\/span><span style=\"color: #D4D4D4\"> , <\/span><span style=\"color: #CE9178\">&quot;\u307f\u304b\u3093&quot;<\/span><span style=\"color: #D4D4D4\"> , <\/span><span style=\"color: #CE9178\">&quot;\u30d0\u30ca\u30ca&quot;<\/span><span style=\"color: #D4D4D4\">];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">foreach<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$fruits<\/span><span style=\"color: #D4D4D4\"> as <\/span><span style=\"color: #9CDCFE\">$fruit<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;\u597d\u304d\u306a\u679c\u7269\u306f&quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$fruit<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u3067\u3059\u3002&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;\u4eca\u65e5\u306f&quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$fruit<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u3092\u98df\u3079\u307e\u3057\u305f\u3002&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3067\u306f\u300c\u597d\u304d\u306a\u679c\u7269\u306f\u308a\u3093\u3054\u3067\u3059\u3002\u4eca\u65e5\u306f\u308a\u3093\u3054\u3092\u98df\u3079\u307e\u3057\u305f\u3002\u300d\u300c\u597d\u304d\u306a\u679c\u7269\u306f\u307f\u304b\u3093\u3067\u3059\u3002\u4eca\u65e5\u306f\u307f\u304b\u3093\u3092\u98df\u3079\u307e\u3057\u305f\u3002\u300d\u300c\u597d\u304d\u306a\u679c\u7269\u306f\u30d0\u30ca\u30ca\u3067\u3059\u3002\u4eca\u65e5\u306f\u30d0\u30ca\u30ca\u3092\u98df\u3079\u307e\u3057\u305f\u3002\u300d\u3068\u3044\u3046\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br>\u6d41\u308c\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>1 \u6700\u521d\u306b\u914d\u5217\u306e\u5909\u6570$fruits\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/li>\n\n\n\n<li>2 foreach($fruits ~\u3000\u306f\u3001\u3053\u306e\u90e8\u5206\u3067\u5b9a\u7fa9\u3057\u305f\u914d\u5217\u3092\u53d6\u5f97\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li>3 ~ as $fruit)\u3000\u306f\u3001$fruits\u306b\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u914d\u5217\u306e\u6700\u521d\u306e\u8981\u7d20\u3067\u3042\u308b\u300c\u308a\u3093\u3054\u300d\u3092$fruit\u306b\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n\n\n\n<li>4 {}\u5185\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u5b9f\u65bd\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li> 5 $fruit\u306b\u4ee3\u5165\u3055\u308c\u305f\u300c\u308a\u3093\u3054\u300d\u306e{}\u5185\u306e\u51e6\u7406\u304c\u5b9f\u65bd\u3055\u308c\u305f\u3089\u3001\u6b21\u306e\u914d\u5217\u306e\u8981\u7d20\u3067\u3042\u308b\u300c\u307f\u304b\u3093\u300d\u3067\u30823.\u30684.\u304c\u5b9f\u65bd\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>6 \u300c\u307f\u304b\u3093\u300d\u3067\u30823.\u30684.\u304c\u5b9f\u65bd\u3055\u308c\u305f\u3089\u3001\u6b21\u306f\u914d\u5217$fruits\u306e\u6700\u5f8c\u306e\u8981\u7d20\u3067\u3042\u308b\u300c\u30d0\u30ca\u30ca\u300d\u30823.\u30684.\u304c\u5b9f\u65bd\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>7 \u5168\u3066\u306e\u8981\u7d20\u306b\u5bfe\u3057\u3066\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u7d42\u4e86\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">foreach\u6587\uff08\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u3001\u9023\u60f3\u914d\u5217\u306e\u5834\u5408\uff09<\/h3>\n\n\n\n<p>\u5148\u307b\u3069\u306eforeach\u6587\u3067\u306f\u3001\u914d\u5217\u306b\u30ad\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u914d\u5217\u306e\u30ad\u30fc\u3082\u7528\u610f\u3055\u308c\u3066\uff08\u9023\u60f3\u914d\u5217\u306b\u306a\u3063\u3066\uff09\u3044\u3066\u3001\u30ad\u30fc\u3082\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u6b21\u306e\u3088\u3046\u306a\u66f8\u304d\u65b9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$fruits = [&quot;\u308a\u3093\u3054&quot; =&gt; &quot;\u8d64&quot; , &quot;\u307f\u304b\u3093&quot; =&gt;&quot;\u30aa\u30ec\u30f3\u30b8&quot; , &quot;\u30d0\u30ca\u30ca&quot; =&gt; &quot;\u9ec4&quot;];\nforeach($fruits as $key =&gt; $value){\n  print($key .&quot;\u306f&quot; . $value . &quot;\u8272\u3067\u3059\u3002&quot;);\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$fruits<\/span><span style=\"color: #D4D4D4\"> = [<\/span><span style=\"color: #CE9178\">&quot;\u308a\u3093\u3054&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;\u8d64&quot;<\/span><span style=\"color: #D4D4D4\"> , <\/span><span style=\"color: #CE9178\">&quot;\u307f\u304b\u3093&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt;<\/span><span style=\"color: #CE9178\">&quot;\u30aa\u30ec\u30f3\u30b8&quot;<\/span><span style=\"color: #D4D4D4\"> , <\/span><span style=\"color: #CE9178\">&quot;\u30d0\u30ca\u30ca&quot;<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #CE9178\">&quot;\u9ec4&quot;<\/span><span style=\"color: #D4D4D4\">];<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">foreach<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$fruits<\/span><span style=\"color: #D4D4D4\"> as <\/span><span style=\"color: #9CDCFE\">$key<\/span><span style=\"color: #D4D4D4\"> =&gt; <\/span><span style=\"color: #9CDCFE\">$value<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$key<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #CE9178\">&quot;\u306f&quot;<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #9CDCFE\">$value<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #D4D4D4\">.<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;\u8272\u3067\u3059\u3002&quot;<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u3061\u3089\u306f\u300c\u308a\u3093\u3054\u306f\u8d64\u8272\u3067\u3059\u3002\u300d\u300c\u307f\u304b\u3093\u306f\u30aa\u30ec\u30f3\u30b8\u8272\u3067\u3059\u3002\u300d\u300c\u30d0\u30ca\u30ca\u306f\u9ec4\u8272\u3067\u3059\u3002\u300d\u3068\u8868\u793a\u3055\u308c\u307e\u3059\u3002\u5148\u307b\u3069\u306eforeach\u6587\u3068\u6bd4\u8f03\u3059\u308b\u3068\u300c$key =&gt;\u300d\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u3053\u3053\u306b\u914d\u5217\u306e\u5404\u8981\u7d20\u306e\u30ad\u30fc\u3067\u3042\u308b\u308a\u3093\u3054\u30fb\u307f\u304b\u3093\u30fb\u30d0\u30ca\u30ca\u304c\u4ee3\u5165\u3055\u308c\u3001\u5024\u306e\u8d64\u30fb\u30aa\u30ec\u30f3\u30b8\u30fb\u9ec4\u306f$value\u306b\u4ee3\u5165\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">while\u6587<\/h3>\n\n\n\n<p>while\u6587\u3067\u3082\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306f\u53ef\u80fd\u3067\u3059\u3002\u66f8\u304d\u65b9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n\/\/\u521d\u671f\u6761\u4ef6\nwhile(\u6761\u4ef6\u5f0f){\n  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406;\n  \u6761\u4ef6\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406;\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A9955\">\/\/\u521d\u671f\u6761\u4ef6<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\">(\u6761\u4ef6\u5f0f){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  \u6761\u4ef6\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u6761\u4ef6\u5f0f\u304ctrue\u306e\u5834\u5408\u306b{ }\u5185\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002while\u6587\u306f\u66f8\u304d\u65b9\u306b\u3044\u304f\u3064\u304b\u6ce8\u610f\u304c\u3042\u308a\u307e\u3059\u3002<span style=\"color:blue;\">\u7279\u306b\u6ce8\u610f\u3057\u3066\u3044\u305f\u3060\u304d\u305f\u3044\u306e\u306f\u3001\u521d\u671f\u6761\u4ef6\u3068\u6761\u4ef6\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406<\/span>\u306b\u95a2\u3057\u3066\u3067\u3059\u3002\u5177\u4f53\u4f8b\u3092\u3044\u304f\u3064\u304b\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p>\u3010\u5177\u4f53\u4f8b1\u3011<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$num = 1;\nwhile($num &lt;= 3){\n  print($num);\n  $num++;\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> &lt;= <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u554f\u984c\u306a\u304f\u300c1 2 3\u300d\u3068\u51fa\u529b\u3067\u304d\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3010\u5177\u4f53\u4f8b2\u3011<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$num = 1;\nwhile($num &lt;= 3){\n  $num++;\n  print($num);\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> &lt;= <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u6b21\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u3002\u4e2d\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3068\u6761\u4ef6\u3092\u5909\u66f4\u3059\u308b\u51e6\u7406\u306e\u9806\u756a\u3092\u5165\u308c\u66ff\u3048\u3066\u307f\u307e\u3057\u305f\u3002\u4eca\u5ea6\u306e\u7d50\u679c\u306f\u300c<span style=\"color:red;\"><strong>2 3 4<\/strong><\/span>\u300d\u3068\u51fa\u529b\u3055\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u308c\u306fwhile\u6587\u306e\u4e2d\u306e{}\u3067\u9806\u6b21\u51e6\u7406\u3055\u308c\u3066\u3044\u308b\u304b\u3089\u3067\u3059\u3002\u9806\u3092\u8ffd\u3046\u3068<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>$num = 1 \u306f$num &lt;= 3\u304ctrue\u306a\u306e\u3067{}\u5185\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u308b\u3002<\/li>\n\n\n\n<li>$num++ \u3067$num\u306b\u4ee3\u5165\u3055\u308c\u3066\u3044\u308b\u5024\u306f2\u306b\u306a\u308b\u3002<\/li>\n\n\n\n<li>print($num); \u30672\u304c\u51fa\u529b\u3055\u308c\u308b\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002print\u95a2\u6570\u3092\u7528\u3044\u308b\u524d\u306b$num\u3092\u30a4\u30f3\u30af\u30ea\u30e1\u30f3\u30c8\uff081\u3092\u52a0\u7b97\uff09\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u300c<span style=\"color:red;\"><strong>2 3 4<\/strong><\/span>\u300d\u3068\u306a\u308a\u307e\u3059\u3002<span style=\"color:blue;\">4\u306b\u95a2\u3057\u3066\u306f3\u3088\u308a\u5927\u304d\u3044\u3067\u3059\u3002\u3067\u3059\u304c\u3053\u306e4\u306f$num = 3\u306e\u6642\u306b{}\u5185\u306e\u51e6\u7406\u306b\u4ee5\u964d\u3057\u305f\u5f8c\u3001$num++\u3067$num\u306b4\u304c\u4ee3\u5165\u3055\u308c\u308b<\/span>\u305f\u3081\u3001print\u95a2\u6570\u3092\u5b9f\u884c\u3057\u30664\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<br>\u3053\u306e\u69d8\u306b\u3001\u5b9f\u884c\u306e\u9806\u5e8f\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u3010\u5177\u4f53\u4f8b3\u3011<br>\u3000\u203b\u3053\u3061\u3089\u306f\u51e6\u7406\u304c\u6b62\u307e\u3089\u306a\u304f\u306a\u308b\uff08\u7121\u9650\u30eb\u30fc\u30d7\uff09\u305f\u3081\u3001\u5b9f\u884c\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\nwhile($num &lt;= 3){\n  $num = 1;\n  print($num);\n  $num++;\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> &lt;= <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">++;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u306e\u5834\u5408\u3001\u5192\u982d\u306b\u66f8\u304d\u307e\u3057\u305f\u304c\u51e6\u7406\u304c\u6b62\u307e\u3089\u306a\u304f\u306a\u308a\u307e\u3059\uff0811111&#8230;..\uff09\u3002\u3053\u308c\u306f\u521d\u671f\u6761\u4ef6\u3068\u3057\u3066\u4f7f\u7528\u3057\u3066\u3044\u308b$num\u304c\u3001while\u6587\u306e{}\u5185\u306b\u3042\u308b\u3053\u3068\u304c\u539f\u56e0\u3067\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>1 $num\u306b1\u3092\u4ee3\u5165\u3057\u3066print\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u305f\u3081\u30011\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>2 \u305d\u306e\u5f8c$num++\u3067$num\u306b\u306f2\u304c\u4ee3\u5165\u3055\u308c\u307e\u3059\u3002<\/li>\n\n\n\n<li>3 $num &lt;= 3\u304ctrue\u3067\u3059\u3002while\u6587\u304c\u518d\u5ea6\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002{}\u5185\u306e\u6700\u521d\u306b$num = 1;\u304c\u3042\u308b\u305f\u3081\u3001\u518d\u5ea61\u304c\u4ee3\u5165\u3055\u308c\u307e\u3059\u30021.\u306e\u90e8\u5206\u306b\u623b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3010\u5177\u4f53\u4f8b4\u3011<br>\u203b\u3053\u3061\u3089\u3082\u51e6\u7406\u304c\u6b62\u307e\u3089\u306a\u304f\u306a\u308b\uff08\u7121\u9650\u30eb\u30fc\u30d7\uff09\u305f\u3081\u3001\u5b9f\u884c\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$num = 1;\nwhile($num &lt;= 3){\n  print($num);\n}\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">1<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> &lt;= <\/span><span style=\"color: #B5CEA8\">3<\/span><span style=\"color: #D4D4D4\">){<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u3053\u3061\u3089\u3082\u5192\u982d\u306b\u66f8\u304d\u307e\u3057\u305f\u304c\u3001\u7121\u9650\u30eb\u30fc\u30d7\u51e6\u7406\u306b\u306a\u308a\u307e\u3059\u3002while\u6587\u5185\u3067\u6761\u4ef6\u3092\u66f4\u65b0\u3059\u308b\u51e6\u7406\u306e\u8a18\u8f09\u304c\u3042\u308a\u307e\u305b\u3093\u3002$num =1\u306f\u5909\u66f4\u3055\u308c\u305a\u3001$num &lt;= 3\u304ctrue\u306e\u307e\u307e\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<br>\u5177\u4f53\u4f8b\u30924\u3064\u6319\u3052\u307e\u3057\u305f\u304c\u3001while\u6587\u3092\u66f8\u304f\u969b\u306f\u3044\u304f\u3064\u304b\u6ce8\u610f\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">do{ }while( )\u6587<\/h3>\n\n\n\n<p>do{}while()\u6587\u306fwhile\u6587\u3068\u307b\u307c\u540c\u3058\u3067\u3059\u3002\u66f8\u304d\u65b9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n\u521d\u671f\u6761\u4ef6\ndo {\n  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406\n} while (\u6761\u4ef6\u5f0f);\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u521d\u671f\u6761\u4ef6<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">do<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  \u5b9f\u65bd\u3059\u308b\u7e70\u308a\u8fd4\u3057\u51e6\u7406<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\"> (\u6761\u4ef6\u5f0f);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>while\u6587\u30681\u70b9\u9055\u3046\u306e\u306f\u3001\u69cb\u6587\u306e\u69cb\u9020\u4e0a\u3001\u5148\u306b\u7e70\u308a\u8fd4\u3057\u306e\u51e6\u7406\u3092\u884c\u3063\u3066\u304b\u3089\u6761\u4ef6\u306e\u5224\u5b9a\u3092\u884c\u3046\u3053\u3068\u3067\u3059\u3002\u5c11\u306a\u304f\u3068\u30821\u56de\u306f\u6761\u4ef6\u306e\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u307e\u3059\u3002\u5177\u4f53\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#1E1E1E\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;?php\n$num = 5;\ndo {\n  print(&quot;\u6570\u5b57\u306f10\u4ee5\u4e0a\u3067\u3059\u3002&quot;)\n} while ($num &gt;= 10);\n?&gt;\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D4D4D4\">&lt;?php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> = <\/span><span style=\"color: #B5CEA8\">5<\/span><span style=\"color: #D4D4D4\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #C586C0\">do<\/span><span style=\"color: #D4D4D4\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">  <\/span><span style=\"color: #DCDCAA\">print<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #CE9178\">&quot;\u6570\u5b57\u306f10\u4ee5\u4e0a\u3067\u3059\u3002&quot;<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">} <\/span><span style=\"color: #C586C0\">while<\/span><span style=\"color: #D4D4D4\"> (<\/span><span style=\"color: #9CDCFE\">$num<\/span><span style=\"color: #D4D4D4\"> &gt;= <\/span><span style=\"color: #B5CEA8\">10<\/span><span style=\"color: #D4D4D4\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">?&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u300c\u6570\u5b57\u306f10\u4ee5\u4e0a\u3067\u3059\u3002\u300d\u3068\u8868\u793a\u3055\u308c\u305f\u304b\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u308c\u306fdo{}\u5185\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u5148\u306b1\u5ea6\u5b9f\u884c\u3057\u3066\u304b\u3089while()\u5185\u306e\u6761\u4ef6\u5f0f\u306e\u5224\u5b9a\u3092\u884c\u306a\u3063\u3066\u3044\u305f\u3081\u3067\u3059\u3002pirnt\u95a2\u6570\u304c\u5b9f\u884c\u3055\u308c\u305f\u3042\u3068\u3001$num &gt;= 10\u306e\u6761\u4ef6\u3067false\u304c\u8fd4\u5374\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001\u305d\u3053\u3067\u51e6\u7406\u304c\u6b62\u307e\u308a\u307e\u3059\u3002\u3088\u3063\u3066\u3001do{}while()\u6587\u3067\u306f\u3001\u5c11\u306a\u304f\u3068\u30821\u56de\u306f\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u304c\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<br><div class=\"wp-block-button\"><a class=\"wp-block-button__link has-very-dark-gray-color has-light-green-cyan-background-color has-text-color has-background wp-element-button\" href=\"https:\/\/tetraup.com\/education\/trial-form\" style=\"border-radius:3px\" target=\"_blank\" rel=\"noreferrer noopener\">\u7121\u6599\u4f53\u9a13\u6388\u696d\u306e\u304a\u7533\u8fbc\u307f\u306f\u30b3\u30c1\u30e9<\/a><\/div><br>\n\n\n\n<h2 class=\"wp-block-heading\">\u307e\u3068\u3081<\/h2>\n\n\n\n<p>\u3044\u304b\u304c\u3067\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002\u4eca\u56de\u306fPHP\u3067\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3092\u3054\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3057\u305f\u3002<br><a href=\"https:\/\/tetraup.com\/news_topics\/column\/php-part10\" title=\"\">\u6b21\u56de<\/a>\u306fPHP\u306b\u304a\u3051\u308b\u95a2\u6570\u3092\u7d39\u4ecb\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6700\u5f8c\u306b<\/h2>\n\n\n\n<p>\u5f53\u6559\u5ba4<a href=\"https:\/\/tetraup.com\/\" title=\"\">TETRA UP<\/a>\u3067\u306f\u3001\u4e3b\u306b\u4f01\u696d\u7814\u4fee\u3084\u30a4\u30d9\u30f3\u30c8\u3067\u53d6\u308a\u6271\u3046\u4eca\u56de\u306ePHP\u306b\u9650\u3089\u305a\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u57fa\u790e\u3092\u5b66\u3079\u308b<a href=\"https:\/\/tetraup.com\/education\/course\/scratch\">Scratch\u30b3\u30fc\u30b9<\/a>\u3001\u3082\u306e\u3065\u304f\u308a\u3068\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u5b9f\u969b\u89e6\u3063\u3066\u5b66\u3079\u308b<a href=\"https:\/\/tetraup.com\/education\/course\/robot\">\u30ed\u30dc\u30c3\u30c8\u30b3\u30fc\u30b9<\/a>\u3001\u305d\u3057\u3066\u672c\u683c\u7684\u306a\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u7fd2\u5f97\u3067\u304d\u308b<a href=\"https:\/\/tetraup.com\/education\/course\/unity\">unity\u30b3\u30fc\u30b9<\/a>\u3001\u305d\u3057\u3066\u7dcf\u30e6\u30fc\u30b6\u30fc\u6570\u7d044\u5104\u4eba\u306e<a href=\"https:\/\/tetraup.com\/education\/course\/roblox\" title=\"\">Roblox\u30b3\u30fc\u30b9<\/a>\u3082\u5c55\u958b\u3057\u3066\u304a\u308a\u307e\u3059\u3002\u30aa\u30f3\u30e9\u30a4\u30f3\u3067\u3082\u53d7\u3051\u4ed8\u3051\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001\u3053\u306e\u6a5f\u4f1a\u306b\u30b3\u30c1\u30e9\u3088\u308a\u4f53\u9a13\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<br><div class=\"wp-block-button\"><a class=\"wp-block-button__link has-very-dark-gray-color has-light-green-cyan-background-color has-text-color has-background wp-element-button\" href=\"https:\/\/tetraup.com\/education\/trial-form\" style=\"border-radius:3px\" target=\"_blank\" rel=\"noreferrer noopener\">\u7121\u6599\u4f53\u9a13\u6388\u696d\u306e\u304a\u7533\u8fbc\u307f\u306f\u30b3\u30c1\u30e9<\/a><\/div><br>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u306fPHP\u306e\u6761\u4ef6\u5206\u5c90\u306b\u3064\u3044\u3066\u8aac\u660e\u3057\u307e\u3057\u305f\u3002\u4eca\u56de\u306fPHP\u306e\u7e70\u308a\u8fd4\u3057\u51e6\u7406\u306b\u3064\u3044\u3066\u8aac\u660e\u3044\u305f\u3057\u307e\u3059\u3002 \u7121\u6599\u4f53\u9a13\u6388\u696d\u306e\u304a\u7533\u8fbc\u307f\u306f\u30b3\u30c1\u30e9 \u7e70\u308a\u8fd4\u3057\u51e6\u7406\u3068\u306f \u300c\u3042\u308b\u6761\u4ef6\u304c\u6e80\u305f\u3055\u308c\u308b\u307e\u3067\u3001\u540c\u3058\u51e6\u7406\u304c\u7e70\u308a\u8fd4\u3057\u5b9f\u884c\u3055\u308c\u308b\u51e6\u7406\u300d\u306e\u3053\u3068\u3092\u3001\u7e70 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":9027,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[37],"tags":[82,60],"class_list":["post-7428","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-column","tag-php","tag-web-site"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/posts\/7428","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/comments?post=7428"}],"version-history":[{"count":8,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/posts\/7428\/revisions"}],"predecessor-version":[{"id":10490,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/posts\/7428\/revisions\/10490"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/media\/9027"}],"wp:attachment":[{"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/media?parent=7428"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/categories?post=7428"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tetraup.com\/news_topics\/wp-json\/wp\/v2\/tags?post=7428"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}