`
sillycat
  • 浏览: 2560703 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

PHP(3)Update the Version and Read the Doc Grammar

 
阅读更多

PHP(3)Update the Version and Read the Doc Grammar

1. Check MAC Software Installation
Check the version of apache
>sudo apachectl -v
Server version: Apache/2.2.26 (Unix) Server built:   Dec 10 2013 22:09:38

Start the Server
>sudo apachectl start

Uncomments this line is /etc/apache2/httpd.conf
LoadModule php5_module libexec/apache2/libphp5.so

Prepare the configuration
>sudo cp php.ini.default php.ini

Prepare the php file
>cat /Library/WebServer/Documents/info.php
<?php phpinfo(); ?>

Visit the page http://localhost/info.php
PHP Version 5.4.24 
I already have my mysql.

I download the file http://us1.php.net/distributions/php-5.5.12.tar.gz

2. PHP Grammer
Link the working directory under apache document root
>sudo ln -s /Users/carl/work/easy/easyphp /Library/WebServer/Documents/easyphp

Array
$arr = array("foo" => 1, 12 => true); 
echo gettype($arr[12]) . "<br />"; 
echo $arr[12]; 

output: 
boolean 


If we did not set the key, it will be the max key + 1.
unset($arr[5]); // This removes the element from the array 
unset($arr);    // This deletes the whole array 

// Create a simple array. 
$array = array(1, 2, 3, 4, 5); 
print_r($array); 
echo "<br />"; 
// Now delete every item, but leave the array itself intact: 
foreach ($array as $i => $v) { 
    unset($array[$i]); 
    echo "unset $i => $v" . "<br />"; 


The array_values() function can be used to 'remove and shift’. 

$arr = array('fruit' => 'apple', 'veggie' => 'carrot'); 
// Correct 
print $arr['fruit']."<br />";  // apple 
print $arr['veggie']."<br />"; // carrot 
// This defines a constant to demonstrate what's going on.  The value 'veggie' 
// is assigned to a constant named fruit. 
define('fruit', 'veggie'); 
// Notice the difference now 
print $arr['fruit']."<br />";  // apple 
print $arr[fruit]."<br />";    // carrot 

<?php 
$a_bool = TRUE;   // a boolean 
$a_str  = "foo";  // a string 
$a_str2 = 'foo';  // a string 
$an_int = 12;     // an integer 

echo gettype($a_bool); // prints out:  boolean 
echo '<br />'; 
echo gettype($a_str);  // prints out:  string 

// If this is an integer, increment it by four 
if (is_int($an_int)) { 
    $an_int += 4; 

echo "<br />"; 
echo $an_int; 
// If $bool is a string, print it out 
// (does not print out anything) 
if (is_string($a_bool)) { 
    echo "String: $a_bool"; 

?> 

class foo 

    var $foo; 
    var $bar; 

    function foo() 
    { 
        $this->foo = 'Foo'; 
        $this->bar = array('Bar1', 'Bar2', 'Bar3'); 
    } 


$foo = new foo(); 
$name = 'MyName'; 

echo <<<EOT 
My name is "$name". I am printing some $foo->foo. 
Now, I am printing some {$foo->bar[1]}. 
This should print a capital 'A': \x41 
EOT; 
?> 
The above example will output: 

My name is "MyName". I am printing some Foo. 
Now, I am printing some Bar2. 
This should print a capital 'A': A 


References:
PHP(1) ~ (2)
http://sillycat.iteye.com/blog/1543227  win7 php installation and php types
http://sillycat.iteye.com/blog/1638638  MAC php installation

http://sillycat.iteye.com/blog/1040371  PHP installation on ubuntu

PHP(一) ~ (三)
http://sillycat.iteye.com/blog/768664 installation
http://sillycat.iteye.com/blog/769110 hello world
http://sillycat.iteye.com/blog/770369  basic grammer

http://sillycat.iteye.com/blog/731677 ogame source codes setup

http://www.php.net/
http://www.php.net/manual/en/language.types.array.php

分享到:
评论

相关推荐

    The Grammar of Graphics

    ### 图形语法(The Grammar of Graphics):统计可视化的核心理论 #### 一、引言 《图形语法》(The Grammar of Graphics) 是一本在统计学和数据可视化领域具有里程碑意义的著作,它由 Leland Wilkinson 编写,并于...

    A unit 2 Vocabulary and grammar练习题精选.doc

    【标题】: "A unit 2 Vocabulary and grammar练习题精选.doc" 【描述】: 这份文档包含了8A第二单元的词汇与语法精选练习题目,旨在帮助学生巩固和提升英语学习中的词汇和语法知识。 【标签】: "文档" 【部分内容...

    The Grammar

    ### 图形学经典教材《The Grammar of Graphics》第二版概览与知识点解析 #### 一、书籍背景介绍 《The Grammar of Graphics》是一本在图形学领域享有盛誉的经典教材,由Leland Wilkinson撰写,第二版出版于2005年...

    人教版高中英语必修二教案:unit 2 the olympic games period 5 grammar.doc

    3. **未来被动语态的用法**: - **按计划或安排将要发生的动作**:当我们将要进行的动作是根据已知的计划或安排来确定的,通常使用未来被动语态。例如:"The next Olympic Games will be held in Paris in 2024."...

    Ginger automatically corrects spelling and grammar

    能够对word里的汉语和英文进行语法检测,并能够提出修改意见,对于写论文有很大的帮助,快速比较简单。

    Just Enough English Grammar Illustrated

    To make grasping grammar easier--and more fun--Just Enough English Grammar uses colorful cartoons illustrate each important grammar point. You see the grammar concept in action, guaranteeing you will ...

    English around the world-Grammar学案.doc

    这篇文档标题为"English around the world - Grammar 学案",说明这是一个关于全球英语语法的学习材料。从内容来看,主要涉及的是将直接引语转化为间接引语的语法知识点。 直接引语是直接引用某人说的话,而间接...

    a Unit 4 Grammar I and II练习题精选.doc

    【Unit 4 Grammar I and II】是丽华中学张咏梅老师提供的一个英语语法练习题集,主要关注的是If引导的条件句以及动词的时态应用。在If引导的条件句中,通常分为两种类型:真实条件句(第一种情况)和非真实条件句...

    Better Grammar in 30 Minutes a Day.doc

    《Better Grammar in 30 Minutes a Day》是由Constance Immel和Florence Sacks两位专家精心编著的英语语法提升指南书,该书由Career Press出版于1994年。本书的出现,对于那些希望提高英语写作准确性和流畅性的人们...

    Database design and development tool BDB Professional V2.6

    3.The database auto-update. Carry out the database auto-update without affecting the data of the original table. In addition, you can carry out the database auto-update development quickly and ...

    database design and database deployment tool BDB 2007 Developer V2.6

    3.The database auto-update. Carry out the database auto-update without affecting the data of the original table. In addition, you can carry out the database auto-update development quickly and ...

    database design and database deployment tool BDB 2007 Professional V2.6

    3.The database auto-update. Carry out the database auto-update without affecting the data of the original table. In addition, you can carry out the database auto-update development quickly and ...

    2020学年七年级英语下册 Unit4 My Classroom Grammar and Task导学案(无答案).doc

    在七年级英语下册Unit4 My Classroom的Grammar and Task部分,主要学习了与教室环境相关的词汇和表达,以及如何使用There be句型来描述物体的存在位置。以下是对这部分内容的详细解析: 1. **学习短语**: - 一块...

    人教版高中英语必修二教案:unit 3 computers period 5 grammar.doc

    【人教版高中英语必修二Unit 3 Computers Period 5 Grammar】教学方案主要围绕现在完成时的被动语态展开,旨在帮助学生理解和正确运用这一语法结构。现在完成时的被动语态在英语中有着重要的应用,特别是在描述过去...

    Friendship-Grammar and language points学案.doc

    - 时间状语:now -&gt; then, today -&gt; that day, yesterday -&gt; the day before, tomorrow -&gt; the next day, tonight -&gt; that night - 地点状语:here -&gt; there - 动词:come -&gt; go, bring -&gt; take 3. **人称代词的...

    English around the world-Grammar学案(1).doc

    2. 原句:“Don’t pass until the green light is on,” the policeman said to him. 转换为:The policeman told him not to pass until the green light was on. 这些转换遵循了人称、时态和语序的变化规则。 ...

    The C programming Language(chm格式完整版)

    Low Level I/O - Read and Write Open, Creat, Close, Unlink Random Access - Lseek Example - An implementation of Fopen and Getc Example - Listing Directories Example - A Storage Allocator Appendix...

Global site tag (gtag.js) - Google Analytics