0519 Exam Exercises

Source: Internet
Author: User
Tags php mysql

1.
LAMP: Architecture Mode l:linux System A: Apache server m:mysql Database P:
2.
PHP language
Lamp Features: Running faster, small size,
3.
SQL statements
CREATE TABLE name: Creat table Name (
Code int PRIMARY KEY,
Column name data type ... (Pay special attention to the last column without commas)
);

Add: INSERT into database name. Table name values (data, comma separated by column order)
Eg:insert into users values (' p001 ', ' Zhang San ', ' Male ');

Modify: Update table Set column = new value, column = new value where condition
Eg:update users Set code = ' P001 ' WHERE code = ' P002 ';

Delete: Delete form table where condition
Query: Select Results display column form table where condition

Change Name: Select Code as ' code name ' from users;
4.
b/S: Brower Server Web page, Web system based on browser
5.
The difference between single and double quotation marks in PHP contains strings:
Double quotation marks inside can parse escape character, single quotation mark inside will be output, double quotation mark inside can parse variable, single quotation mark not can
6.
$x = 1;
+ + $x;
$y = $x + +; $y = $x; $x = $x +1

Output $y=2;

$x = 1;
+ + $x;
$y = + + $x; $x = $x +1; $y = $x;

Output $y=3
7.
Implode () stitching the array into a string; explode () splits the string into an array

8.
<?php
$email = ' [email protected] ';
$str = Strstr ($email, ' @ ');
$info = Explode ('. ', $str);
Print_r ($info);
?>
Output result: Array ([0]=> @thizlinux [1]=>com [2]=>CN]

9.
Array_values (); Re-index function array_unique (); de-weight function

10.
Time function: Date (' y-m-d h:i:s '); current time
Time (' y-m-d h:i:s '); current timestamp
11.
The constructor and destructor of the parent class are automatically called;

Member variables need to be decorated with public,private,protected, and the VAR keyword is no longer required when defining variables;

A static member defined in a parent class that cannot be called directly in a subclass;

Classes that contain abstract methods must be abstract classes, abstract classes cannot be instantiated, can only be inherited, and are

Implementation of specific functions in subclasses;

The source code of PHP is open;

OPP is an object-oriented abbreviation;

A static member belongs to a class, and the ordinary member belongs to the object;

The $this keyword inside the class represents the object itself;

The list () function is written on the left side of the equal sign;

each () function can return the next element inside the array;

foreach () iterates through the array and can traverse both key and value;

For only iterating through an indexed array, associative arrays are not allowed;
12
function Print_a ()
{
$A = "Phpchina";
The value of echo "A" is: "$A." <p> ";
return ($A);
}
$B =print_a ();
The value of echo "B" is: "$B." <p> ";
The output is: The value of A is: Phpchina
The value of B is:

Because $b is not a return value, the output is empty, and if there is a value of return (a) B: Phpchina

13.
$A = "HELLO";
function Print_a ()
{
$A = "php mysql";
Global $A; Global is globally variable
Echo $A;
}
Echo $A;
Print_a ();

The output is: Hellohello;

14.
& Transfer Address
<?php
$a = 10;
$b =& $a;
Echo $b;
$b = 15;
Echo $b;
?>
Output Results 1015
15.
$attr = Array ("One" = "AA", "1" = "BB", "Three" and "CC");
echo $attr ["one"];
echo $attr [1];
Echo $attr ["1"];

The output is: AA bb bb
The main reason is because PHP is a weak type of language, you can directly convert the string to a number
16.
$attr = Array (1,2,3,4);
while (list ($key, $value) =each ($attr))
{
echo $key. " = ". $value." <br> ";
}
while (list ($key, $value) =each ($attr))
{
echo $key. " = ". $value." <br> ";
}

The result of the output is: 0=>1
1=>2
2=>3
3=>4
Only these four rows of data: Because each () function takes the value down one point to the next, where it has been completely taken out and will not be executed;

17.
Boolean data in PHP has only two values: True and False (or true false or 0 1)

The symbol for connecting two strings in PHP is ".", used as a concatenation string

PHP can not use scanf to print arrays

Add ";" at the end of each statement. To represent the end of a statement

PHP is a weakly typed language, so you don't need to define the type of the variable when you use it.

in php "= =" means "equals", "=" is an assignment

The while statement is: first judge the condition and then execute the loop body, Do-while is the first to execute the loop body in judging condition

Break means to jump out of the loop; Continue is to jump out of this cycle

If the definition array is the omitted keyword key, then the third element of the array is the keyword 2, since the index is starting from 0;

Query data in MySQL database with SELECT statement

0519 Exam Exercises

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.