is a weakly typed variable that does not need to specify its variable type when declaring it, and does not need to follow the "declare before use" and can be used whenever you want. A variable in which a local variable is in effect in a shell is not
PHP Language Summary: Basic syntax type constant operator Process Control function class and object namespace super global variable garbage collection mechanism1 Basic Syntax*php Markecho "Hello World";... more codeecho "last Statement";The script
Reads a file, assigns each row to an array of variables, and prints it out with a for loop
Copy Code code as follows:
#!/bin/sh
I=1
sum= ' sed-n ' $= ' tmp.txt ' #计算文件的总行数
echo "$SUM"
While Read line
Todo
arr[$i]= "$line"
the basic syntax of a shellAssignments generally take the following form: variable name = string1. "=" number can not be a space on either side, or it will be wrong. (This beginner is particularly prone to mistakes)2. If there is nothing after "="
1. Array definition, the shell uses a pair of parentheses to represent the array, and the array elements are separated by "spaces"
# empty array arr1
arr1= ()
# array arr2, members are 1, 2, 3, 4, 5, 6
arr2= (1 2 3 4 5 6)
2. Array elements read,
/**** Description of Parameters * * key names with the same $key key value * * $array represents the original array * * $start represents $array[0][$key]** $newkey represents the same key name **/function Combine_same_val ($array, $start, $key,
Bash programming arrays and string handlingDirectoryNote Date 20180405ArrayFame (Create) array declare-a array_nameAssignment of array elements array_name= ("VAL1" "VAL2" "VAL3" ...)Referencing an array element: ${array_name[index]}Bash's string
We have selected 70 shell foot questions and answers you may encounter for your interview. Knowing a script or at least knowing the basics is critical to your system administrator, and it helps you automate many tasks in your work environment. Over
PHP can also detect access to Windows memory information, and the code is quite simple, no intention to find, feel later to use, here with you to share.
This code will get the total memory, the initial use of memory information:
01
02echo
An array $a0 has n elements, and the 3rd element in it is ranked first in the array.The first approach is:Take out the 3rd element and assign to the variable $ AThe 3rd element of the unsetArray_unshift adds $ A to the array header.If it is an array
If you want to delete an element in an array, you can use the unset directly, but what I see today is a surprise to me.
$arr = Array (' A ', ' B ', ' C ', ' d ');Unset ($arr [1]);Print_r ($arr);?>Print_r ($arr)
After that, the result is not that,
"The concept of serialization"
Serialization is the process of converting an object's state into a format that can be persisted or transmitted. The opposite of serialization is deserialization, which converts a stream to an object. These two
The simplest combination of arrays we just use Array_merge to
Array_merge () merges the cells of two or more arrays, and the values in one array are appended to the previous array. Returns an array as the result.
When the array key name is a
PHP developers should be aware that PHP has a lot of built-in functions, mastered them, can help you in doing PHP development more handy, this article will share 8 development of the necessary PHP features, all are very practical, I hope you can
This article illustrates how PHP implements a method of finding a specific value in a multidimensional array. Share to everyone for your reference. Specifically as follows:
Recently, you need to look up a multidimensional array to see if it
one, foreach () loop the array internal pointer no longer works, before PHP7, when the array passes through a foreach iteration, the arrays pointer moves. Starting now, no longer, see the following code ...
$array = [0, 1, 2];
foreach
1. Any number of parameters of the function
You may know that PHP allows you to define a function of a default parameter. But you may not know that PHP also allows you to define a function of an entirely arbitrary parameter
Here is an example of a
Numeric arrayThe numeric array stores each element with a numeric ID key.
You can use different methods to create an array of values:
Example 1In this example, the ID key is assigned automatically:
The code is as follows
Copy Code
"The concept of serialization"
Serialization is the process of converting an object's state into a format that can be persisted or transmitted. The opposite of serialization is deserialization, which converts a stream to an object. These two
If you want to delete an element in an array, you can use the unset directly, but what I see today is a surprise to me.
Copy Code code as follows:
$arr = Array (' A ', ' B ', ' C ', ' d ');
Unset ($arr [1]);
Print_r ($arr);
?>
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.