インクリメント演算子は、どうも言語によってかなり扱いが違うことに気がついた。 後置インクリメントまず、実行しようと思うコードの擬似表現は以下。このコードを実行すると、どのような結果が出力されるだろうか? まずは頭の中で考えてほしい。 なお、「a++」の部分は「後置インクリメント」と呼ばれ、式自体の評価値はインクリメント前の値になる。つまり、「a++」の評価値はいずれの言語でも1になる。 a = 1; print (a + a++); 計算し終わっただろうか。では上記コードを各種言語で実行した場合の結果を見てみよう。 C言語の場合 http://codepad.org/VXw0Uo2IJavaScriptの場合 ↓をアドレスバーに貼り付けてEnterで実行できる javascript:var a=1; alert(a + a++);PHPの場合 http://codepad.org/Ho7p
平素より「PHPプロ!」をご愛顧いただき、誠にありがとうございます。 2006年より運営してまいりました「PHPプロ!」ですが、サービスの利用状況を鑑みまして、2018年9月25日(火曜日)をもちましてサービスを終了させていただくことになりました。 サービス終了に伴いまして、2018年8月28日(火曜日)を持ちまして、新規会員登録ならびにQ&A掲示板への新たな質問、回答の投稿を停止させていただきます。 なお、ご登録いただいた皆様の個人情報につきましては、サービス終了後、弊社が責任をもって消去いたします。 これまで多くの皆様にご利用をいただきまして、誠にありがとうございました。 サービス終了に伴い、皆様にはご不便をおかけいたしますこと、心よりお詫び申し上げます。 本件に関するお問い合わせはこちらよりお願いいたします。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く