易截截图软件、单文件、免安装、纯绿色、仅160KB

php 基础笔记 string

/***************************by
garcon1986********************************/
<?php
// example for strings, single quoted, double quoted
echo 'display a string!<br>';
echo ' this displays
a splitted
string<br>';
echo 'i\'ll be "back"<br>';
echo 'she said:"i\'ll be back!"<br>';
echo 'the path is c:\programmes\sjg\*.*!'.'            '.'hello world<br>';
echo 'the path is c:\\prgralles\\sjg\*.*<p>';
$h = 'hellos';
$i = "hellos";
echo '$h<br>';
echo "$h"."<br>";
echo '$i<br>';
echo "$i<br>";
//heredoc example
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
/* More complex example, with variables. */
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;
echo '$str<br>';
echo "$str<p>";
// variable parsing
$beer = "xuehua";
echo "$beer's taste is good<br>";// works; "'" is an invalid character for variable names
echo "he drinks some $beers<br>";// won't work; 's' is a valid character for variable names but the variable is "$beer
echo "he drinks some ${beer}s<br>";//works
echo "he drinks some {$beer}s<br>";//works
error_reporting(E_ALL);
$fruits = array('strawberry' => 'red', 'banana' => 'yellow');
echo "A banana is $fruits[banana].<br>";
echo "A banana is {$fruits['banana']}.<br>";
echo "A banana is {$fruits[banana]}.<br>"; // Works but PHP looks for a constant named


相关文档:

一些被忽视的 PHP 函数

转载自:http://www.gracecode.com/archives/3013/
作者:手气不错
真的是不用不知道,其实我们熟悉的 PHP 还有很多好东西没有发掘。看到这篇文章
,当时就泪奔了好几回,重点推荐下,顺便我自己也做个整理。
sys_getloadavg()
这个函数
返回当前系统的负载均值信息
(当然 Windows 下不适用),详细文档可以翻阅 PH ......

php 基础笔记 logic statements

/***************************by
garcon1986********************************/
<?php
//if 语句
$a = $b = 3;
if($a = $b)
print "a is equal to b<br>";
//else 语句
if($a < $b){
print "a is smaller than b";
} else {
print "a is not smaller than b<br> ......

php 基础笔记 functions

/***************************by
garcon1986********************************/
<?php
//example1
$makefoo = true;
bar();
if($makefoo){
function foo(){
echo "doesn't exist.<br>";
}
}
if($makefoo)foo();
function bar(){
echo "exist<br>";
}
//example2
funct ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号