<?php //PHP: LOOP THROUGH EACH STRING LINE IN A TEXTAREA //trim off excess whitespace off the whole $text = trim($_POST['textareaname']); //explode all separate lines into an array $textAr = explode("\n", $text); //trim all lines contained in the array. $textAr = array_filter($textAr, 'trim'); //loop through the lines foreach($textAr as $line){ echo "$line"; } function bubble_sort($arr) { $size = count($arr); for ($i=0; $i<$size; $i++) { for ($j=0; $j<$size-1-$i; $j++) { if ($arr[$j+1] < $arr[$j]) { swap($arr, $j, $j+1); } } } return $arr; } function swap(&$arr, $a, $b) { $tmp = $arr[$a]; $arr[$a] = $arr[$b]; $arr[$b] = $tmp; } /* test bubble sort *...
Komentar
Posting Komentar