$newItem->appendChild($tmp); $tmp = $xml->createElement('URL'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][1]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('BodyType'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][2]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Make'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][3]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Model'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][4]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Year', trim($data->sheets[0]['cells'][$i][5])); $newItem->appendChild($tmp); $tmp = $xml->createElement('Price', get_numerics(trim($data->sheets[0]['cells'][$i][6]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Region'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][7]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('City'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][8]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Street'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][9]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('Metro'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][10]))); $newItem->appendChild($tmp); $tmp = $xml->createElement('ContactName'); $tmp->appendChild($xml->createCDATASection(trim($data->sheets[0]['cells'][$i][11])));
</head> <body> <form method="post"> <textarea rows="5" cols="60" name="c"></textarea> <input type="submit"> </form> <?php function get_numerics($str) { preg_match_all('/\\d+/', $str, $matches); return $matches[0]; } if (!empty($_POST['c'])) { $text = chop($_POST['c']); $pole = get_numerics($text); $lup = 0; for ($i = 0; $i < count($pole); $i++) { $lup = $lup + $pole[$i]; } echo $lup . '<br>'; if (($lup + 0) % 500 > 494) { echo 'na stejnem ostrove plno'; } if (($lup + 330) % 500 > 494) { echo 'plno s 30 hoplity a 6 katapulty'; } if (($lup + 510) % 500 > 494) { echo 'plno s 30 hoplity a 12 katapulty'; } if (($lup + 690) % 500 > 494) {