<?php
$string = 'Stack Overflow+_)(*&^%$#{}[]<>@!~./=-'; //My string
$shuffleTimes = 100;
$table = new table($string, $shuffleTimes);
class table {
function __construct($string, $time) {
$out = '<table cellpadding="5">';
$out .= $this->getRow('th', 'Nom., Shuffled String, Lenght');
for ($x = 1; $x <= $time; $x++) {
$shuffledStr = str_shuffle($string); //Maybe this causes the problem
$shuffledStr_len = mb_strlen($shuffledStr);
$out .= $this->getRow('td', $x . ', ' . $shuffledStr . ', ' . $shuffledStr_len);
}
$out .= '</table>';
echo $out;
}
public function getRow($tagName, $contents_list) {
//Variables:
$out = '';
$contents_array = explode(', ', $contents_list);
$contents_number = count($contents_array);
$start_tag = '<' . $tagName . '>';
$end_tag = '</' . $tagName . '>';
// Build
$out .= '<tr>';
for ($i = 0; $i < $contents_number; $i++) {
$out .= $start_tag . $contents_array[$i] . $end_tag;
}
$out .= '</tr>';
return $out;
}
}
preferences:
36.42 ms | 402 KiB | 5 Q