{"componentChunkName":"component---src-templates-blog-post-tsx","path":"/blog/2020-01-06-start-php/","result":{"data":{"site":{"siteMetadata":{"title":"Ouvill のブログ","author":"Ouvill(おーびる)","siteUrl":"https://blog.ouvill.net"}},"defaultCover":{"childImageSharp":{"gatsbyImageData":{"layout":"constrained","backgroundColor":"#d8d8d8","images":{"fallback":{"src":"/static/b1addcc2c923340c2baaa1236d2555d2/2c1fd/site-header.jpg","srcSet":"/static/b1addcc2c923340c2baaa1236d2555d2/78489/site-header.jpg 80w,\n/static/b1addcc2c923340c2baaa1236d2555d2/9d796/site-header.jpg 160w,\n/static/b1addcc2c923340c2baaa1236d2555d2/2c1fd/site-header.jpg 320w,\n/static/b1addcc2c923340c2baaa1236d2555d2/394a8/site-header.jpg 640w","sizes":"(min-width: 320px) 320px, 100vw"},"sources":[{"srcSet":"/static/b1addcc2c923340c2baaa1236d2555d2/fd305/site-header.avif 80w,\n/static/b1addcc2c923340c2baaa1236d2555d2/3675f/site-header.avif 160w,\n/static/b1addcc2c923340c2baaa1236d2555d2/d94f4/site-header.avif 320w,\n/static/b1addcc2c923340c2baaa1236d2555d2/54e23/site-header.avif 640w","type":"image/avif","sizes":"(min-width: 320px) 320px, 100vw"},{"srcSet":"/static/b1addcc2c923340c2baaa1236d2555d2/0e3bd/site-header.webp 80w,\n/static/b1addcc2c923340c2baaa1236d2555d2/f7b29/site-header.webp 160w,\n/static/b1addcc2c923340c2baaa1236d2555d2/09d71/site-header.webp 320w,\n/static/b1addcc2c923340c2baaa1236d2555d2/359e0/site-header.webp 640w","type":"image/webp","sizes":"(min-width: 320px) 320px, 100vw"}]},"width":320,"height":200}},"publicURL":"/static/b1addcc2c923340c2baaa1236d2555d2/site-header.jpg"},"allMarkdownRemark":{"edges":[{"node":{"excerpt":"…","fields":{"slug":"/blog/2024-09-04-2024_programming_language/"},"frontmatter":{"date":"2024/09/04","title":"プログラミング言語雑感(2024年)：C, C++, Java, C#, Python, JavaScript,　Ruby, PHP, Flutter, Rust, Go","description":null,"cover":null}}},{"node":{"excerpt":"こんにちは！最近、ティラノスクリプトのプラグインをリリースしました。このプラグインは、ティラノスクリプトに表示されるメッセージを逐次VOICEVOX…","fields":{"slug":"/blog/2024-08-19-create_tyranoscript_plugin/"},"frontmatter":{"date":"2024/08/20","title":"ティラノスクリプトのプラグイン開発：VOICEVOXプラグインの経験から","description":null,"cover":null}}},{"node":{"excerpt":"我々が普段利用しているパソコンにはCPUが搭載されており、そのCPUはx86_64(AMD64)というアーキテクチャを持っている。しかし、Raspberry PiなどのARMベースのマイコンにはARM64というアーキテクチャを持っている。ARM64とx86_6…","fields":{"slug":"/blog/2023-01-26-build_docker_multi_architecture_with_github_action/GitHub_ActionでARM64とAMD64のDockerイメージをビルドする/"},"frontmatter":{"date":"2023/01/26","title":"GitHub_ActionでARM64とAMD64のDockerイメージをビルドする","description":null,"cover":null}}}]},"markdownRemark":{"id":"60db2d06-1157-5956-b0e1-2cf2f966372a","excerpt":"PHP のお勉強 PHP のお勉強 PHP コード php のコードは で囲まれた中に記述します。 変数 PHP…","fields":{"slug":"/blog/2020-01-06-start-php/","githubURL":"https://github.com/Ouvill/gatsbyjs_blog/tree/master/content/blog/2020-01-06-start-php/index.md"},"html":"<h2 id=\"php-のお勉強\" style=\"position:relative;\"><a href=\"#php-%E3%81%AE%E3%81%8A%E5%8B%89%E5%BC%B7\" aria-label=\"php のお勉強 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>PHP のお勉強</h2>\n<p>PHP のお勉強</p>\n<h2 id=\"php-コード\" style=\"position:relative;\"><a href=\"#php-%E3%82%B3%E3%83%BC%E3%83%89\" aria-label=\"php コード permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>PHP コード</h2>\n<p>php のコードは <code class=\"language-text\">&lt;?php ?></code>で囲まれた中に記述します。</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n<span class=\"token comment\">// phpコードを記述する</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<h2 id=\"変数\" style=\"position:relative;\"><a href=\"#%E5%A4%89%E6%95%B0\" aria-label=\"変数 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>変数</h2>\n<p>PHP の変数は <code class=\"language-text\">$</code> をつける。大文字と小文字で区別される</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n<span class=\"token variable\">$name</span><span class=\"token operator\">=</span><span class=\"token string double-quoted-string\">\"Ouvill\"</span>\n<span class=\"token keyword\">echo</span> <span class=\"token variable\">$name</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>出力例</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Ouvill</code></pre></div>\n<h2 id=\"文字列を表示する\" style=\"position:relative;\"><a href=\"#%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B\" aria-label=\"文字列を表示する permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>文字列を表示する</h2>\n<p><code class=\"language-text\">echo</code> で文字を表示できる</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token string double-quoted-string\">\"Hello PHP!!&lt;br/>\"</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token string double-quoted-string\">\"10 + 7&lt;br/>\"</span><span class=\"token punctuation\">;</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token number\">10</span> <span class=\"token operator\">+</span> <span class=\"token number\">7</span><span class=\"token punctuation\">;</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>表示例</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">Hello PHP\n10 + 7\n17</code></pre></div>\n<p><code class=\"language-text\">\"\"(ダブルクオーテーション)</code>や<code class=\"language-text\">''（シングルクオーテーションマーク）</code>で囲まれたものは文字列になる</p>\n<h3 id=\"-と--の違い\" style=\"position:relative;\"><a href=\"#-%E3%81%A8--%E3%81%AE%E9%81%95%E3%81%84\" aria-label=\" と  の違い permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>\"\" と ” の違い</h3>\n<p><code class=\"language-text\">\"\"</code> で囲まれた文字列は変数展開ができる。<code class=\"language-text\">''</code>では変数展開されない。</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n    <span class=\"token variable\">$hello</span> <span class=\"token operator\">=</span> <span class=\"token string double-quoted-string\">\"Hello World\"</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token string double-quoted-string\">\"変数展開される ${hello}\"</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token string single-quoted-string\">'変数展開されない ${hello}'</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>出力例</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">変数展開される Hello World\n変数展開されない ${hello}</code></pre></div>\n<h2 id=\"文字列の連結\" style=\"position:relative;\"><a href=\"#%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E9%80%A3%E7%B5%90\" aria-label=\"文字列の連結 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>文字列の連結</h2>\n<p>PHPでは、連結用の演算子<code class=\"language-text\">.</code>がある。\n<code class=\"language-text\">.</code> を利用することで文字列の連結ができる。</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n    <span class=\"token variable\">$php</span> <span class=\"token operator\">=</span> <span class=\"token string double-quoted-string\">\"PHP\"</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token string double-quoted-string\">\"Hello\"</span><span class=\"token operator\">.</span><span class=\"token variable\">$php</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>出力例</p>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">HelloPHP</code></pre></div>\n<h2 id=\"if-文条件分岐\" style=\"position:relative;\"><a href=\"#if-%E6%96%87%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90\" aria-label=\"if 文条件分岐 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>if 文、条件分岐</h2>\n<p>他言語と同様に if 文がある</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n<span class=\"token keyword\">if</span> <span class=\"token punctuation\">(</span> 条件式 <span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">// true のとき</span>\n<span class=\"token punctuation\">}</span> <span class=\"token keyword\">else</span> <span class=\"token punctuation\">{</span> \n    <span class=\"token comment\">// false のとき</span>\n<span class=\"token punctuation\">}</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<h2 id=\"for文\" style=\"position:relative;\"><a href=\"#for%E6%96%87\" aria-label=\"for文 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>for文</h2>\n<p>他言語と同様に for 文がある</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n<span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span>初期値式<span class=\"token punctuation\">;</span> 条件式<span class=\"token punctuation\">;</span> 増減式<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token comment\">//ループ内容</span>\n<span class=\"token punctuation\">}</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>例,1 ~ 100 までを出力する</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span><span class=\"token variable\">$i</span> <span class=\"token operator\">=</span> <span class=\"token number\">1</span><span class=\"token punctuation\">;</span> <span class=\"token variable\">$i</span> <span class=\"token operator\">&lt;=</span> <span class=\"token number\">100</span><span class=\"token punctuation\">;</span> <span class=\"token variable\">$i</span><span class=\"token operator\">++</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token variable\">$i</span><span class=\"token operator\">.</span><span class=\"token string double-quoted-string\">\"&lt;br>\"</span>\n</code></pre></div>\n<h2 id=\"foreach-文\" style=\"position:relative;\"><a href=\"#foreach-%E6%96%87\" aria-label=\"foreach 文 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>foreach 文</h2>\n<p><code class=\"language-text\">foreach ( 配列 as $key )</code> で要素に順番にアクセスできる。</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n<span class=\"token variable\">$fruits</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">array</span><span class=\"token punctuation\">(</span><span class=\"token string double-quoted-string\">\"りんご\"</span><span class=\"token punctuation\">,</span><span class=\"token string double-quoted-string\">\"みかん\"</span><span class=\"token punctuation\">,</span><span class=\"token string double-quoted-string\">\"バナナ\"</span><span class=\"token punctuation\">)</span>\n<span class=\"token keyword\">foreach</span> <span class=\"token punctuation\">(</span><span class=\"token variable\">$fruits</span> <span class=\"token keyword\">as</span> <span class=\"token variable\">$fruit</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">echo</span> <span class=\"token variable\">$fruit</span>\n<span class=\"token punctuation\">}</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>\n<p>連想配列の場合も利用できる.</p>\n<div class=\"gatsby-highlight\" data-language=\"php\"><pre class=\"language-php\"><code class=\"language-php\"><span class=\"token php language-php\"><span class=\"token delimiter important\">&lt;?php</span>\n  <span class=\"token variable\">$a</span> <span class=\"token operator\">=</span> <span class=\"token keyword\">array</span><span class=\"token punctuation\">(</span><span class=\"token string double-quoted-string\">\"Apple\"</span> <span class=\"token operator\">=></span> <span class=\"token string double-quoted-string\">\"りんご\"</span><span class=\"token punctuation\">,</span> <span class=\"token string double-quoted-string\">\"Orange\"</span> <span class=\"token operator\">=></span> <span class=\"token string double-quoted-string\">\"みかん\"</span><span class=\"token punctuation\">,</span> \n             <span class=\"token string double-quoted-string\">\"Grape\"</span> <span class=\"token operator\">=></span> <span class=\"token string double-quoted-string\">\"ぶどう\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token keyword\">foreach</span><span class=\"token punctuation\">(</span> <span class=\"token variable\">$a</span> <span class=\"token keyword\">as</span> <span class=\"token variable\">$key</span> <span class=\"token operator\">=></span> <span class=\"token variable\">$value</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token keyword\">print</span><span class=\"token punctuation\">(</span><span class=\"token string double-quoted-string\">\"<span class=\"token interpolation\"><span class=\"token variable\">$key</span></span> は、<span class=\"token interpolation\"><span class=\"token variable\">$value</span></span>&lt;br>\\n\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n     <span class=\"token punctuation\">}</span>\n<span class=\"token delimiter important\">?></span></span></code></pre></div>","htmlAst":{"type":"root","children":[{"type":"element","tagName":"h2","properties":{"id":"php-のお勉強","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#php-%E3%81%AE%E3%81%8A%E5%8B%89%E5%BC%B7","ariaLabel":"php のお勉強 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"PHP のお勉強"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"PHP のお勉強"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"php-コード","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#php-%E3%82%B3%E3%83%BC%E3%83%89","ariaLabel":"php コード permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"PHP コード"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"php のコードは "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"<?php ?>"}]},{"type":"text","value":"で囲まれた中に記述します。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"// phpコードを記述する"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"変数","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%A4%89%E6%95%B0","ariaLabel":"変数 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"変数"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"PHP の変数は "},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"$"}]},{"type":"text","value":" をつける。大文字と小文字で区別される"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$name"}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Ouvill\""}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$name"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"出力例"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"Ouvill"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"文字列を表示する","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B","ariaLabel":"文字列を表示する permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"文字列を表示する"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" で文字を表示できる"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Hello PHP!!<br/>\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"10 + 7<br/>\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"10"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"+"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"7"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"表示例"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"Hello PHP\n10 + 7\n17"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"\"\"(ダブルクオーテーション)"}]},{"type":"text","value":"や"},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"''（シングルクオーテーションマーク）"}]},{"type":"text","value":"で囲まれたものは文字列になる"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"-と--の違い","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#-%E3%81%A8--%E3%81%AE%E9%81%95%E3%81%84","ariaLabel":" と  の違い permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"\"\" と ” の違い"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"\"\""}]},{"type":"text","value":" で囲まれた文字列は変数展開ができる。"},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"''"}]},{"type":"text","value":"では変数展開されない。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$hello"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Hello World\""}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"変数展開される ${hello}\""}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","single-quoted-string"]},"children":[{"type":"text","value":"'変数展開されない ${hello}'"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"出力例"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"変数展開される Hello World\n変数展開されない ${hello}"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"文字列の連結","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E9%80%A3%E7%B5%90","ariaLabel":"文字列の連結 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"文字列の連結"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"PHPでは、連結用の演算子"},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":"がある。\n"},{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"."}]},{"type":"text","value":" を利用することで文字列の連結ができる。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$php"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"PHP\""}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Hello\""}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"."}]},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"出力例"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"text"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-text"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"HelloPHP"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"if-文条件分岐","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#if-%E6%96%87%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90","ariaLabel":"if 文条件分岐 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"if 文、条件分岐"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"他言語と同様に if 文がある"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"if"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":" 条件式 "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"// true のとき"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"else"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":" \n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"// false のとき"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"for文","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#for%E6%96%87","ariaLabel":"for文 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"for文"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"他言語と同様に for 文がある"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"for"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":"初期値式"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":" 条件式"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":" 増減式"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","comment"]},"children":[{"type":"text","value":"//ループ内容"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"例,1 ~ 100 までを出力する"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"for"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$i"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"1"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$i"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"<="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","number"]},"children":[{"type":"text","value":"100"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$i"}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"++"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$i"}]},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"."}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"<br>\""}]},{"type":"text","value":"\n"}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"foreach-文","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#foreach-%E6%96%87","ariaLabel":"foreach 文 permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"foreach 文"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"code","properties":{"className":["language-text"]},"children":[{"type":"text","value":"foreach ( 配列 as $key )"}]},{"type":"text","value":" で要素に順番にアクセスできる。"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$fruits"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"array"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"りんご\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"みかん\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"バナナ\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"foreach"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$fruits"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"as"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$fruit"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":"\n    "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"echo"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$fruit"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"連想配列の場合も利用できる."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"div","properties":{"className":["gatsby-highlight"],"dataLanguage":"php"},"children":[{"type":"element","tagName":"pre","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","php","language-php"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"<?php"}]},{"type":"text","value":"\n  "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$a"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"="}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"array"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Apple\""}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"=>"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"りんご\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Orange\""}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"=>"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"みかん\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":","}]},{"type":"text","value":" \n             "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"Grape\""}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"=>"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\"ぶどう\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":"\n      "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"foreach"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$a"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"as"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$key"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","operator"]},"children":[{"type":"text","value":"=>"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$value"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"text","value":" "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"{"}]},{"type":"text","value":"\n      "},{"type":"element","tagName":"span","properties":{"className":["token","keyword"]},"children":[{"type":"text","value":"print"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"("}]},{"type":"element","tagName":"span","properties":{"className":["token","string","double-quoted-string"]},"children":[{"type":"text","value":"\""},{"type":"element","tagName":"span","properties":{"className":["token","interpolation"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$key"}]}]},{"type":"text","value":" は、"},{"type":"element","tagName":"span","properties":{"className":["token","interpolation"]},"children":[{"type":"element","tagName":"span","properties":{"className":["token","variable"]},"children":[{"type":"text","value":"$value"}]}]},{"type":"text","value":"<br>\\n\""}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":")"}]},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":";"}]},{"type":"text","value":"\n     "},{"type":"element","tagName":"span","properties":{"className":["token","punctuation"]},"children":[{"type":"text","value":"}"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"span","properties":{"className":["token","delimiter","important"]},"children":[{"type":"text","value":"?>"}]}]}]}]}]}],"data":{"quirksMode":false}},"tableOfContents":"<ul>\n<li>\n<p><a href=\"#php-%E3%81%AE%E3%81%8A%E5%8B%89%E5%BC%B7\">PHP のお勉強</a></p>\n</li>\n<li>\n<p><a href=\"#php-%E3%82%B3%E3%83%BC%E3%83%89\">PHP コード</a></p>\n</li>\n<li>\n<p><a href=\"#%E5%A4%89%E6%95%B0\">変数</a></p>\n</li>\n<li>\n<p><a href=\"#%E6%96%87%E5%AD%97%E5%88%97%E3%82%92%E8%A1%A8%E7%A4%BA%E3%81%99%E3%82%8B\">文字列を表示する</a></p>\n<ul>\n<li><a href=\"#-%E3%81%A8--%E3%81%AE%E9%81%95%E3%81%84\">\"\" と ” の違い</a></li>\n</ul>\n</li>\n<li>\n<p><a href=\"#%E6%96%87%E5%AD%97%E5%88%97%E3%81%AE%E9%80%A3%E7%B5%90\">文字列の連結</a></p>\n</li>\n<li>\n<p><a href=\"#if-%E6%96%87%E6%9D%A1%E4%BB%B6%E5%88%86%E5%B2%90\">if 文、条件分岐</a></p>\n</li>\n<li>\n<p><a href=\"#for%E6%96%87\">for文</a></p>\n</li>\n<li>\n<p><a href=\"#foreach-%E6%96%87\">foreach 文</a></p>\n</li>\n</ul>","frontmatter":{"title":"PHP のお勉強","date":"2020/01/06,","description":"","cover":null}}},"pageContext":{"slug":"/blog/2020-01-06-start-php/","defaultCover":"/opt/build/repo/content/assets/site-header.jpg","previous":{"fields":{"slug":"/blog/2019-06-28-change_blog_vewpress_to_gatsbyjs/"},"frontmatter":{"title":"ブログを VuePress から GatsbyJS に変更"}},"next":{"fields":{"slug":"/blog/2020-01-07-start-php3/"},"frontmatter":{"title":"PHP のお勉強3"}}}},"staticQueryHashes":["2239373282","3905181353"],"slicesMap":{}}