Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 1. Print array
- //Write a script that allocates array of 20 integers and initializes each element by its index multiplied by 5. Print the obtained array //on the console.
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- </head>
- <body>
- <?php
- foreach(range(0, 20, 1) as $v=>$k){
- $myArray[$k]=$k*5;
- }
- echo '<pre>' . print_r($myArray, true) . '</pre>';
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment