PHP code - what does this piece of code mean?

what does the assignment do in this cycle? I do not get array notation in it: S

foreach($fieldvalues as $fieldvalue){ $insertvalues[] = $fieldvalue; } 
+6
arrays php
source share
5 answers

$insertvalues[] means to insert a new element into an array, its label is array_push (). He was also preferred because he created less overhead while running PHP.

Additionally:

For those who donโ€™t know how the loop works.

 foreach($fieldvalues as $fieldvalue) 

every time a loop ... loop, the value of $fieldvalue becomes the next value that the pointer looks for in the $fieldvalues , adding this to the new $ insertvalues โ€‹โ€‹array using the label syntax mentioned above.

+3
source share

Add $fieldvalue to the end of the $insertvalues .

+5
source share

Inserts a new element at the end of the array.

Other languages โ€‹โ€‹have the function of adding or clicking for this.

+1
source share

It adds the value of $fieldvalue at the end of the $insertvalues . [] creates an array, and the values โ€‹โ€‹of the specified variable are added to it at the end each time.

0
source share

I think this is a variable for the new array.

0
source share

All Articles