Çıkışından aralığı kaldırma

0 Cevap

Ben bu kodu var ve ben bireysel girişlerin infaz yaptığınızda kesinlikle çalışıyor ama bir döngü girişleri eklediğinizde, bu ekstra aralık son kelime arasında eklendi alır gidecekseniz. O nereden geldiğini ben bulamıyorum.

burada kodu:

function new($term)
{

    $exp = explode(" ", $term);

    sort($exp);

    foreach($exp as $val)
    {
        echo $val;
    }

}

Bu temelde "k duz q rc lvraw", "duzklvrawqrc" içine yazdığınız sadece new("k duz q rc lvraw") dönüştürür

but if I have $a = array("k duz q rc lvraw", "mybea zdr yubx xe dyroiy"); ve with the code

foreach($a as $test)
{

new($test);
echo "\n";

}

Çıkışı çıkıyor

"duzklvraw
qrc"

ve

"dyroiy
mybeaxeyubxzdr"

This extra "\n" gets added, before the last few characters ve at the end of the sentence ve when you try to copy/paste it.. the lines are not consistent.

Neden böyle oluyor ... Bu tam kodu!

0 Cevap