List piemērs 2 - 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 List piemērs 2.php
- <?php
- $myList = [
- 'This',
- 'is',
- 'a',
- 'lot',
- 'of',
- 'seperate',
- 'list',
- 'items',
- 'and',
- 'you',
- 'can',
- 'add',
- 'any',
- 'extra',
- 'how',
- 'mutch',
- 'you',
- 'want',
- ];
- echo makeList($myList);
- echo makeList($myList,true);
- echo makeList($myList,false,true);
- function makeList($data, $ucFirst = false, $ucAll = false) {
- $rc = '';
- $rc .= '<ul style="margin-bottom:1em;">';
- foreach($data as $oneItem) {
- if($ucAll) {
- $oneItem = strtoupper($oneItem);
- }
- if($ucFirst) {
- $oneItem = ucfirst($oneItem);
- }
- $rc .= '<li>'.$oneItem.'</li>';
- }
- $rc .= '</ul>';
- return $rc;
- }
- ?>
File Description
- List piemērs 2
- PHP Code
- 15 Sep-2021
- 870 Bytes
You can Share it:
Latest PHP Pastes