In every programming language we will certainly encounter the concept of variable.Variable is a place in memory to store data whose value can be changed during program run.In PHP, every variable always begins with the sign '$' and followed by the name of the variable, regardless of whether the data is integer, real or string, PHP will automatically convert the data according to type. Variable names can be any combination of letters of the alphabet and numbers with a maximum length of 32 characters. But unlike in most other programming languages that require us to declare variables in advance, variables in PHP do not have to be declared before the variable is used. Varabel represented by certain words with the rules of writing as follows:
1. Variables begin with a dollar sign ($).
2. The length is unlimited.
3. It should begin with the letter or underscore (_). The next character can only contain letters, numbers, and certain characters are allowed (ASCII characters from 127-255).
4. May not use punctuation.
5. Case sensitive or uppercase and lowercase letters are different.
6. Do not use a word that is the built-in PHP.
7. No need to be declared
8. Can not contain spaces.
Examples of Variables:
True False
$ _name
$ first_name
$ name3
$ name_3
$ 3name
$ name?
$ first + name
$ first.name
$ first name
In addition to the above matters, there are still some more criteria to consider
in writing the PHP script as follows:
a. Each page that contains PHP script must be saved with the extension PHP
according to the PHP program that supports it. For example: nama_file.php, or
nama_file.php3, or nama_file.php4.
b. Each script must be preceded by an opening PHP PHP (<? Php etc.) and
then concluded with closing (?>).
c. Each line of the script content should be preceded by a print statement like write in Pascal,
the Print and Echo. Writing criteria are as follows:
Print ("The order")
printf ("The order");
Echo "The order";
Echo command
d. Each end of the command line must end with a semicolon (;). Suppose we would write "Hahan", then the script to be written is: <? php print ("haha");?>.
1: <html>
2: <head>
3: <title> Using variables </ title>
4: <head>
5: <body>
6: <? Php
7: $ Name = "STMIK AMIKOM YOGYAKARTA";
8: echo ("Name: $ name");
9: ?>
10: </ Body>
11: </ Html>
dinamis
1: <html>
2: <head>
3: <title> Using variables </ title>
4: <head>
5: <body>
6: action="lat02.php" <form method="post">
7: Enter your Name = <input type="text" name="nama" /> <br>
8: <input type="submit" name="submit" value="simpan" />
9: </ Form>
10: <? Php
11: echo ("Name: $ _POST [name]");
12: ?>
13: </ Body>
14: </ Html>
save with name lat02.php
Technorati Tags: Variable,concept,memory,data,integer,combination,alphabet,length,languages,Varabel,Variables,dollar,letter,ASCII,Case,Examples,True,False,_name,addition,criteria,script,extension,example,statement,Pascal,Print,Echo,Suppose,Hahan,Name,STMIK,AMIKOM,YOGYAKARTA,Body,Html,size,Consolas,Courier,Monospace,margin,width,action,method,Enter,text,Form,_POST,nama_file,csharpcode,ffffff,kwrd,preproc,attr,lnum
Windows Live Tags: Variable,concept,memory,data,integer,combination,alphabet,length,languages,Varabel,Variables,dollar,letter,ASCII,Case,Examples,True,False,_name,addition,criteria,script,extension,example,statement,Pascal,Print,Echo,Suppose,Hahan,Name,STMIK,AMIKOM,YOGYAKARTA,Body,Html,size,Consolas,Courier,Monospace,margin,width,action,method,Enter,text,Form,_POST,nama_file,csharpcode,ffffff,kwrd,preproc,attr,lnum
WordPress Tags: Variable,concept,memory,data,integer,combination,alphabet,length,languages,Varabel,Variables,dollar,letter,ASCII,Case,Examples,True,False,_name,addition,criteria,script,extension,example,statement,Pascal,Print,Echo,Suppose,Hahan,Name,STMIK,AMIKOM,YOGYAKARTA,Body,Html,size,Consolas,Courier,Monospace,margin,width,action,method,Enter,text,Form,_POST,nama_file,csharpcode,ffffff,kwrd,preproc,attr,lnum
Blogger Labels: Variable,concept,memory,data,integer,combination,alphabet,length,languages,Varabel,Variables,dollar,letter,ASCII,Case,Examples,True,False,_name,addition,criteria,script,extension,example,statement,Pascal,Print,Echo,Suppose,Hahan,Name,STMIK,AMIKOM,YOGYAKARTA,Body,Html,size,Consolas,Courier,Monospace,margin,width,action,method,Enter,text,Form,_POST,nama_file,csharpcode,ffffff,kwrd,preproc,attr,lnum
0 comments:
Post a Comment
thank you for visiting my blog and comment here. I hope the commentary contains a comment which intend to build and repair. criticism and suggestions I gladly accept.