PRINTとは? わかりやすく解説

print

(PHP 4, PHP 5)
print — 文字列を出力する

説明

int print ( string arg )
argを出力します。常に 1 を返します。
print()は実際には関数ではありません (言語構造です)。このため、引数を括弧で括る必要はありません。
例 2280. print() の例
<?php
print("Hello World");

print "print() also works without parentheses.";

print "This spans
multiple lines. The newlines will be
output as well";

print "This spans\nmultiple lines. The newlines will be\noutput as well.";

print "escaping characters is done \"Like this\".";

// print文の中で変数を使用することが可能です。
$foo = "foobar";
$bar = "barbaz";

print "foo is $foo"; // foo is foobar

// 配列も使用可能です。
$bar = array("value" => "foo");

print "this is {$bar['value']} !"; // this is foo !

// シングルクオートを使用すると値ではなく変数名が出力されます。
print 'foo is $foo'; // foo is $foo

// 他の文字を使用しない場合、変数だけを出力することが可能です。
print $foo;          // foobar

print <<<END
This uses the "here document" syntax to output
multiple lines with $variable interpolation. Note
that the here document terminator must appear on a
line with just a semicolon no extra whitespace!
END;
?>


print()echo() の違いに関するちょっとした議論については、 FAQTs Knowledge Base の次の記事を参照ください : » http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40
注意: これは、関数ではなく 言語構造のため、可変関数 を用いて コールすることはできません。
echo()printf()flush()も参照ください。




固有名詞の分類

このページでは「PHP関数リファレンス」からPRINTを検索した結果を表示しています。
Weblioに収録されているすべての辞書からPRINTを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からPRINTを検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「PRINT」の関連用語

PRINTのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



PRINTのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS