Echo and Print statements, echoprint statements
In PHP, there are two basic output methods: Echo and Print
The difference between Echo and print:
echo--can output more than one string, no return value
print--can only output one string, and always return a value of 1
Echo's statement:
Echo is a language structure that can be used with or without parentheses: Echo or Echo ();
For example:
Display string:
echo "
PHP is fun!";
echo "Hello world!";
echo "Plan", "Learn", "PHP";
?>
wraps a line of code in a text string using a backslashdocument.write ("Hello World!");6. Note: single-line comments begin with//start multiple lines of comments starting with/*, ending with */7. Variables: Use var keyword to declare variablesvar carname; After a variable declaration, the variable is empty (it has no value) and the value is undefinedvar carname= "Volvo"; declaring and assigning valuesA statement can declare multiple variables at the
PhpArray Sorting
The elements in the array can be sorted in descending or ascending order, in alphabetical or numerical terms.
PHP-Array sorting functionIn this chapter, we will introduce the following PHP array sorting functions:
Sort ()-ascending order of arrays
Rsort ()-Descending order of the array
Asort ()-Sets the array in ascending order based on the values of the associative arrays
Ksort ()-an array is sorted in ascending order based on the keys of the as
The UrlEncode () function works by first converting Chinese characters to 16, and then adding an identifier% to each character.The UrlDecode () function, in contrast to the UrlEncode () function, is used to decode an encoded URL string by converting a hexadecimal string to a Chinese characterPHP common functions;1. Sort (); Sorts the elements in an array by letter (or number) in ascending order:Cases:$cars =array ("Volvo", "BMW", "SAAB");Sort ($cars);
are variables, execution speed is slower than single quotes• Single quotes cannot be nested with single quotes, double quotes cannot be nested double quotesPHP delimiter Requirements: In PHP files, you need to output a bit of JavaScript code;Idea: The browser shows the result of the parsed PHP file, returning a piece of JavaScript code to the browser;4. Boolean boolTrue FalseWhen converting to a bool value, the case is considered false:False itself;Integer value 0;Floating-point value 0.0;The e
alphabetic characters, or you can use Chinese[3] cannot use keywords, reserved words, true, false, and NULL[4] variable is case sensitive[5] identifiers should be in small hump format, the first bit should be the type of data, the common identification is as follows:Array a Aitems Boolean b boolean biscomplete floating-point f float fprice functions fn function Fnhand Ler integer i integer iitemcount objects o object oDIv1 Regular expression re RegExp Reemailcheck string s Stri
1. AngularJS Scope (scope)
Scope (scope) is the link between HTML (view) and JavaScript (controller).
Scope is an object that has methods and properties Available.
Scope can be applied to views and Controllers.
2. Use Scope: when you create a controller in AngularJS, you can pass $Scope object as a parameterDOCTYPE HTML>HTML> Head> MetaCharSet= "UTF-8"> title>title> Scripttype= "text/javascript"src= "js/angular.min.js">Script> style>Input.ng-i
an infinity is a number:Instance
var x = 1000 / 0;isNaN(x); // returns false
A number can be a number or an object.Numbers can be initialized with private data, just as x = 123;JavaScript numeric object initialization data, var y = new Number (123 );Instance
var x = 123;var y = new Number(123);typeof(x) // returns Numbertypeof(y) // returns Object
Instance
var x = 123; var y = new Number(123);(x === y) // is false because x is a number and y is an object.
JavaScript String objectThe Strin
The following data types are defined in javascript:
Strings (String)
Numbers (number)
Boolean (Boolean)
Arrays (Array)
Objects (object)
Null (NULL)
Undefined (Undefined)
1. StringA string is any text enclosed in single quotation marks ' or double quotation marks:var carname= "Volvo XC60"; var carname= ' Volvo XC60 ';If it ‘ is also a character, it can be "" enclosed:var
an underscore _.4. Data types in JS (remember)The ①undefind is not assigned, and the variable declared with VAR has been used but is not assigned a value.②nall represents an empty referenceThe ③boolean boolean type. True Ture, Flase.④number numeric type, can be an integer, can be a decimal,⑤string string type, with "" or "package⑥object Object TypeJavaScript Data TypesUse the VAR keyword to declare the variable:var carname;After the variable declaration, the variable is empty (it has no value).
Because of the university curriculum, the teacher giant love ask questions, also score, casually record JS learning situation, later review what is more convenient bar ...Start, just follow the C language to learn the way to it!================================== cut and cut ==================================1. Data type (This is just a bit of a mention)1 /*2 I think there is no obvious data type in JS, only String, number, Boolean, array, object, Null, Undefined3 */4 5 vartemp = ' legth '6 7 var
1. Manipulating HTML elementsIf you want to access an HTML element from JavaScript, you can use the document.getElementById (ID) method.Use the ID property to identify the HTML element:Example:Access the HTML element with the specified ID and change its contents:2. ArraysThe following code creates an array named cars:var cars=new Array (); cars[0]= "Audi"; cars[1]= "BMW"; cars[2]= "Volvo";or (condensed array):var cars=new Array ("Audi", "BMW", "
.2.1JavaScript Code SpecificationCode specifications typically include the following:
Naming rules for variables and functions
Whitespace, indentation, usage rules for annotations.
Other common specifications ...
The code of the specification can be easier to read and maintain.Code specifications are generally defined prior to development and can be negotiated with your team members to set up2.2 Variable NameThe name of the variable is recommended using the Hump method (Cam
propertiesMax_valueMin_valueNegative_infinityPositive_infinityNaNPrototypeConstructorDigital methodToexponential ()ToFixed ()Toprecision ()ToString ()ValueOf ()JavaScript strings (String) objectA String object is used to handle an existing block of characters.JavaScript stringA string is used to store a series of characters like "John Doe".A string can use either single or double quotation marks:Instancevar carname= "Volvo XC60";var carname= '
JavascriptString Object
A String object is used to handle an existing block of characters.
JavaScript stringA string is used to store a series of characters like "John Doe".A string can use either single or double quotation marks:Example var carname= "Volvo XC60";var carname= ' Volvo XC60 ';You use the location (index) to access any character in the string:Example Var character=carname[7];The in
figure out when and how it happens. At this time, we can use console.trace to debug JavaScript.For example, if you want to see the entire stack details under a car instance funcZ :
var car;var func1 = function () { Func2 ();}var Func2 = function () { Func4 ();}var func3 = function () { }var Func4 = function () { Car =new Car ();Car.funcx ();}var Car = function () { This.brand = ' Volvo '; this.color = ' red '; This.funcx = function
any values.Five, string and integer1) The string is a sequence of characters, such as "Hello world!".The string can be any text within quotation marks. You can use single or double quotation marks:2) IntegerPHP Var_dump () returns the data type and value of the variableResults:int (5985) int ( -345) int (+) int (39)Six, array$cars =array ("Volvo", "BMW", "SAAB"); Var_dump ($cars);Results:Array (3) {[0]=> string (5) "
interpretation. As pictured, the parcel was just in Hawaii, the finger swept into New York, is it soon? The so-called Fingertips Express home. This type of creativity is simple and interesting, and many businesses are happy to use it, such as the following case.
Volvo collision-avoidance mobile creative advertising → http://www.56.com/u65/v_MTEwMjkwNjMw.html
Volvo is known for its safety, a
First of all, let's talk about why digital photos are late. Many photography beginners feel that the better the camera, the less the later, the better the photographer's shooting technology is not needed later, in fact, these two views are not entirely correct. Mainly due to the digital camera photosensitive principle of congenital deficiencies, electronic sensors in terms of latitude do not compare with the chemical film, it is often felt that digital photos are often not enough real, lack of l
the end of the statement, and by using semicolons, you can write multiple statements on one line.
6.Rules for JavaScript variable names:Variable is case sensitive (Y and Y are two different variables)Variable must start with a letter or underscore
7.Declaration of variablesIf the variable you are assigning has not been declared, the variable is declared automatically.Cases:x=5; Carname= "Volvo";The same effect as the following statements: Var x=5;
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.