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

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>";
}
//elseif = else if 语句
if($a>$b){
print "a is bigger than b";
}else if($a = $b){
print "a is equal than b";
}else {
print "a is smaller to b<br>";
}
// when you don't use "{}", you can't separate elseif.
//当不用{}时,elseif不能分开
if($a>$b):
print "a>b";
elseif($a==$b):
//else if($a==$b): // this is wrong
print "a=b";
print '<br>';
endif;
//while语句
$i = 0;
while($i<=10){
print $i++.'<br>';
}
$i=15;
while($i<=20):
print $i;
$i++;
endwhile;
print '<br>';
//The difference between 'do while' and 'while' is: 'do while' will execute once at least.
//do while 和while的区别在于前者至少要执行一次
$i=0;
do {
echo $i;
}while($i>0);
echo '<p>';
//do while example 2
do {
if ($i < 5) {
echo "i is not big enough";
break;
}
$i *= 2;
if ($i < 50) {
break;
}
echo "i is ok";
/* process i */
} while (0);
//for(expression1; expression2; expression3) statement语句
//example1
for($i=0;$i<=6;$i++){
print $i;
}
echo '<br>';
//example2
for($i=0; ; $i++){
if($i>10){
break;
}
print $i;
}
echo '<br>';
//example3
for($i=0;;){
print $i;
$i++;
if($i>6){
break;
}
}
echo '<br>';
//example4
$i=0;
for(;;){
if($i>6){
break;
}
print $i;
$i++;
}
echo '<br>';
//example5
for($i=0;$i<=10;print $i, $i++);
echo '<p>';
//foreach语句
//example1
$arr = array('s','j','g','w','l');
foreach($arr as $value){
echo "$value<br>"; //$value is user-defined.
}
unset($value);
//list to replace foreach, same result
//使


相关文档:

php/jsp RIFF1

练琴的时候把RIFF叫做一个曲子的小片段,那么我自己定义一下程序的RIFF就是一小段程序吧,放一些这几天自己写的,以后也长期更新,作为自己积累和今后编程的参考。
1. 格式化网址,若没有HTTP头则插入HTTP头
<?php
//add http head to url
function AddHttpHead( &$s )
{
$exist = strstr( $s,"http://" ......

PHP5 读取Google 天气预报 XML

Google为全球主要城市提供了统一的天气预报数据存储格式,那就是XML。所有的开发者都可以利用自己喜欢的语言来解析XML获取所需城市的天气预报,本文将介绍利用PHP来获取我所在城市济南的天气预报。
原文见本人网站【PHP探路者】
原文链接:
PHP5 读取Google 天气预报XML API ......

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; charset=gb2312" />
<title>PHP分页</tit ......

IIS+PHP+MYSQL配置功略

PHP的执行效率是有目共睹的,这也是我喜欢它的原因之一,和它称为绝妙搭档的Mysql以及Apache想融合,不能不惊叹其效率了。PHP更新也很快,这里列举了目前最新版本PHP4.3.2RC4(几乎没有BUG了,估计写完这篇不久后正式版就出了),和最新版本的Mysql4.0.13的安装过程。   
  PHP的安装文件可以直接到 &nb ......

一些被忽视的 PHP 函数

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