test - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of test.php
- <?php
- $array = ['element 1', 'element 2', 'element 3', 'element 4', 'element 5', 'element 6'];
- $template_count = 3;//сколько разных типов блоков
- $i=1;
- foreach($array as $item){
- if($i == 1){
- echo "первый тип: " . $item . "\r";
- }
- if($i == 2){
- echo "второй тип: " . $item . "\r";
- }
- if($i == 3){
- echo "третий тип: " . $item . "\r";
- }
- //увеличиваем переменную или сбрасываем
- if($i >= $template_count){
- $i = 1;
- }else{
- $i = $i+1;
- }
- }
File Description
- test
- PHP Code
- 25 Oct-2019
- 633 Bytes
You can Share it:
Latest PHP Pastes