php 基础笔记   variables
	
    
    
	/***************************by
 garcon1986********************************/
<?php
// variable name is sensitive
$var = "sjg";
$Var = "wl";
echo $var.' loves '.$Var.'<br>';
echo "$var, $Var<p>";
//naming conventions for variables
//$4site = 'not yet';    // invalid; starts with a number
$_4site = 'not yet';    // valid; starts with an underscore
$täyte = 'mansikka';    // valid; '洄 is (Extended) ASCII 228.
echo $_4site.'<br>';
echo $täyte.'<p>';
// pass the address
$ref1 = 'ref1';
$ref2 = &$ref1;
echo $ref1.'<br>'; //ref1
echo $ref2.'<br>'; //ref1
$ref2 = "My name is $ref2";
echo $ref1.'<br>'; //ref1
echo $ref2.'<p>'; //ref1
//$ref2 = &(24*7);     //Invalid reference.
function test1()
{
return 25;
}
//$bar = &test();    // Invalid reference.
//global scope ;
$a1 = 1; /* global scope */
function test2()
{
$a1 = 2; // local variable
echo $a1.'<br>'; /* reference to local scope variable */
}
test2();
echo $a1.'<br>'; // global variable
//local scope
$a2 = 3;
$b2 = 4;
function Sum2(){
global $a2, $b2;
$b2 = $a2 + $b2;
}
Sum2();
echo $b2.'<p>';
//static variable
function test3(){
static $a=0;
echo $a;
$a++;
}
test3();
echo '<br>';
test3();
echo '<br>';
test3();
echo '<br>';
test3();
echo '<br>';
test3();
echo '<p>';
//global variable and static variable
function test_global_ref(){
global $obj;
$obj = &new stdClass;
}
function test_global_noref(){
global $obj;
$obj = new stdClass;
}
test_global_ref();
var_dump($obj);
echo '<br>';
test_global_noref();
var_dump($obj);
echo '<p>';
// variable variables
$a3 = 'hello';
$$a3 = 'world';
echo "$a3 ${$a3}"."<br>";
echo "$a3 $hello"."<p>";
?>
 
    
     
	
	
    
    
	相关文档:
        
    
    php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml">   
<head>   
<meta http-equiv="Content-Type" content="text/html; charse ......
	
    
        
    
    看
到这篇文章
,当时就泪奔了好几回,重点推荐下,顺便我自己也做个整理。
sys_getloadavg()
这个函数
返回当前系统的负载均值信息
(当然 Windows
 下不适用),详细文档可以翻阅 PHP 的相关文档。文档中有段示例代码,基本上也就能看出它的用途了。
<?php
$load = sys_getloadavg();
if ($load[0] > 80) ......
	
    
        
    
    还是
部门无聊的考题,不过这次考的是 PHP
 的能力。题目如下:
给你两个分别有 5000 个元素的数组,计算他们的差集
  -- 说白了也就是用 PHP 和你认为最好的算法实现 array_diff 的算法。
初次接到这个题目,我发现这非常的简单,
于是按照以往的经验“随便”写了一个:
function array_diff($array_1, $ ......
	
    
        
    
    
                        Nginx + PHP + Mysql (php-frm 방식)            
                                
         글쓴이 : 
        최고관리자
        
        
 조회 : 2,884                         
        
 ......