for ($i = 1; $i <= $ile; $i++) { $number = $matches[1] - $matches[2]; }
Witam, mam skrypt który w stringu zamienia x-x, na x-x, czyli 5-2, na 3. A jak zrobić żeby brał też pod uwagę -x-x, próbuje dodać - z przodu, ale nic nie daje. :/
for ($i = 1; $i <= $ile; $i++) { $number = $matches[1] - $matches[2]; }
for ($i = 1; $i <= $ile; $i++) { $number = $matches[1] - $matches[2]; }
foreach($matches as $submatches) { if($submatches[1] == '-') { } else { } }
foreach($matches as $submatch) { if($submatch[2] == '-') { } else { } }