zoukankan      html  css  js  c++  java
  • 吴裕雄--天生自然PHP-MySQL-JavaScript学习笔记:PHP的结构

    <?php
      echo "Hello world";
    ?>
    <?php
    /* This is a section
       of multi-line comments
       which will not be
       interpreted */
    ?>
    <?php
      $mycounter = 1;
      $mystring  = "Hello";
      $myarray   = array("One", "Two", "Three");
    ?>
    <?php // test1.php
      $username = "Fred Smith";
      echo $username;
      echo "<br>";
      $current_user = $username;
      echo $current_user;
    ?>
    <?php
      $oxo = array(array('x', ' ', 'o'),
                   array('o', 'o', 'x'),
                   array('x', 'o', ' '));
      
      echo $oxo[1][2];
    ?>
    <?php
      $author = "Steve Ballmer";
    
      echo "Developers, Developers, developers, developers, developers,
      developers, developers, developers, developers!
    
      - $author.";
    ?>
    <?php
      $author = "Bill Gates";
    
      $text = "Measuring programming progress by lines of code is like
      Measuring aircraft building progress by weight.
    
      - $author.";
    ?>
    <?php
      $author = "Brian W. Kernighan";
    
      echo <<<_END
      Debugging is twice as hard as writing the code in the first place.
      Therefore, if you write the code as cleverly as possible, you are,
      by definition, not smart enough to debug it.
      
      - $author.
    _END;
    ?>
    <?php
      $author = "Scott Adams";
    
      $out = <<<_END
      Normal people believe that if it ain’t broke, don’t fix it.
      Engineers believe that if it ain’t broke, it doesn’t have enough
      features yet.
    
      - $author.
    _END;
    ?>
    <?php
      $number = 12345 * 67890;
      echo substr($number, 3, 1);
    ?>
    <?php
      $pi     = "3.1415927";
      $radius = 5;
      echo $pi * ($radius * $radius);
    ?>
    <?php
      function longdate($timestamp)
      {
        return date("l F jS Y", $timestamp);
      }
    ?>
    <?php
      function longdate($timestamp)
      {
        $temp = date("l F jS Y", $timestamp);
        return "The date is $temp";
      }
    ?>
    <?php
      $temp = "The date is ";
      echo longdate(time());
    
      function longdate($timestamp)
      {
        return $temp . date("l F jS Y", $timestamp);
      }
    ?>
    <?php
      $temp = "The date is ";
      echo $temp . longdate(time());
    
      function longdate($timestamp)
      {
        return date("l F jS Y", $timestamp);
      }
    ?>
    <?php
      $temp = "The date is ";
      echo longdate($temp, time());
    
      function longdate($text, $timestamp)
      {
        return $text . date("l F jS Y", $timestamp);
      }
    ?>
    <?php
    
      echo test();
      echo "<br><br>";
      echo test();
        
      function test()
      {
        static $count = 0;
        echo $count;
        $count++;
      }
    ?>
    <?php
      static $int = 0;         // Allowed 
      static $int = 1+2;       // Disallowed (will produce a Parse error)
      static $int = sqrt(144); // Disallowed
    ?>
  • 相关阅读:
    kNN之手写数字识别
    KNN 约会网站配对
    mask_rcnn训练自己的数据集
    Unable to determine the device handle for GPU 0000:01:00.0: GPU is lost.问题排坑
    PAT Advanced 1050 String Subtraction (20) [Hash散列]
    PAT Advanced 1048 Find Coins (25) [Hash散列]
    PAT Advanced 1041 Be Unique (20) [Hash散列]
    PAT Basic 1083 是否存在相等的差 (20) [hash映射,map STL]
    PAT Basic 1047 编程团体赛(20) [Hash散列]
    PAT Basic 1043 输出PATest (20分)[Hash散列]
  • 原文地址:https://www.cnblogs.com/tszr/p/12380557.html
Copyright © 2011-2022 走看看