PHP的print函數(shù)_PHP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:PHP生成隨機(jī)字符串
      PHP生成隨機(jī)字符串的函數(shù),下面是我在網(wǎng)上找到的2個(gè)關(guān)于PHP隨機(jī)字符串的函數(shù),希望大家喜歡。 ?php function genRandomString(len) { chars = array( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t,

      PHP的print函數(shù),姑且說是函數(shù)吧啊。可以使用在PHP 4, PHP 5的環(huán)境中。

      print函數(shù)的作用就是輸出一個(gè)字符串。使用方法:

      int print ( string arg )

       


      print() 是一個(gè)語言結(jié)構(gòu)而非函數(shù),因此它無法被變量函數(shù)調(diào)用。 請看下面的演示:)

      <?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\".";

      // You can use variables inside of a print statement
      foo = "foobar";
      bar = "barbaz";

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

      // You can also use arrays
      bar = array("value" => "foo");

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

      // Using single quotes will print the variable name, not the value
      print 'foo is foo'; // foo is foo

      // If you are not using any other characters, you can just print variables
      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;
      ?>

      注意: 由于這是一個(gè)語言結(jié)構(gòu)而非函數(shù),因此它無法被變量函數(shù)調(diào)用。

      分享:PHP實(shí)例:一無限分類的處理類
      PHP代碼:-------------------------------------------------------------------------------- ?php /* 名稱: 對分類操作的業(yè)務(wù)邏輯封裝 * 說明: 本類中引用的其它類(DB、Table、Item)均未提供,所以本類只能做個(gè)參考,不能直接應(yīng)用 * 不是本人小氣不提供其

      來源:模板無憂//所屬分類:PHP教程/更新時(shí)間:2010-04-12
      相關(guān)PHP教程