search
Homephp教程PHP源码php入门教程-第一课

<script>ec(2);</script>

/*
1、嵌入方法:
类似ASP的,当然您也可以自己指定。

2、引用文件:
引用文件的方法有两种:require及include。
require的使用方法如:require("MyRequireFile.php");
这个函数通常放在PHP程序的最前面,PHP程序在执行前,就会先读入require所指定引入的文件,使它变成PHP程序网页的一部份。常用的函数,亦可以这个方法将它引入网页中。
include使用方法如:include("MyIncludeFile.php");
这个函数一般是放在流程控制的处理部分中。PHP程序网页在读到include的文件时,才将它读进来。这种方式,可以把程序执行时的流程简单化。


echo "这是第一种例子。 " ; // 本例是C++语法的注释
 本例采用多行的
注释方式
echo "这是第二种例子。 " ;
echo "这是第三种例子。 " ; # 本例使用UNIX Shell语法注释
4、变量类型:

 代码如下 复制代码
$mystring = "我是字符串" ;
$NewLine = "换行了 " ;
$int1 = 38 ;
$float1 = 1.732 ;
$float2 = 1.4E+2 ;


$MyArray1 = array( "子" , "丑" , "寅" , "卯" );
这里引出两个问题,首先PHP变量以$开头,第二PHP语句以;结尾,可能ASP程序员会不适应。这两个遗漏也是程序上大多错误所在。

5、运算符号:

数学运算:
符号 意义
+  加法运算
-  减法运算
*  乘法运算
/  除法运算
%  取余数
++  累加
--  递减

字符串运算:
运算符号只有一个,就是英文的句号。它可以将字符串连接起来,变成合并的新字符串。类似ASP中的&


$a = "PHP 4" ;
$b = "功能强大" ;
echo $a.$b;
?>

这里也引出两个问题,首先PHP中输出语句是echo,第二类似ASP中的,PHP中也可以=变量?>。

逻辑运算:
符号 意义
>  大于
>=  大于或等于
==  等于
!=  不等于
&&  而且 (And)
and  而且 (And)
||  或者 (Or)
or  或者 (Or)
xor  异或 (Xor)
!  不 (Not)

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.