Programming is a long, creative process. It is hard enough to learn anything in this area if you do not have any ability to understand the principles by which programs and applications should be built. Today we’ll talk about the array, the elements of the array and the simplest operations with them.
Definition
, . , , , . ? . , , , . . :
. , i integer. PHP -. i - , , , - array ("bar"). .
. - , , . .
- " ". , . , , .
- "". -. , , .
, , , , .
, . , . . , .
- . "", "i", , "", "R", .
- "" .
- . .
- i=1, R=0.
- . . . . - Pascal.
repeat
R=R+M[i];
i=i+1;
until i>k
? "repeat". , , . ( ). "until" , . 5 (=5), [6] , .
, . :
if () then ( ) else (, );
: " , , ". "". .
? , , , . - . ++.
while (i<=k)
{
i=i+1; // i +=1;
if (R <= M[i])
{
R=M[i]
}
}
, , . ? i<=, , [1] "R". "R" , , . , , .
PHP
. , , , . , ?
. . (, ), , ... , , .
PHP - . . , , , . , , .
? - , . , . . , - , . . , . . , , .