Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Preg_replace i błąd
Dawid_
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 21.07.2006

Ostrzeżenie: (0%)
-----


Witam. Pisałem na innych forach, ale nie wiedzą gdzie tkwi błąd.

  1. <?php
  2. $where=preg_replace( '/(.*)/eiU', "'<a href='.(strpos('$1', 'http://') !== 0) ? 'http://$1' : $1.'>'.(strlen('$1')>20) ? substr('$1',0,10).'(...)'.substr('$1',-10).'</a>'", $where);
  3. ?>


Nie działa to jak należy, bowiem wyskakuje błąd:

Parse error: syntax error, unexpected T_FUNCTION in /home/accounts_m/maks/public_html/r+/conf.php(83) : regexp code on line 1

Fatal error: preg_replace(): Failed evaluating code (...) /home/accounts_m/maks/public_html/r+/conf.php on line 83

Oczekuje na odpowiedź. Pozdrawiam
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Dawid_
post
Post #2





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 21.07.2006

Ostrzeżenie: (0%)
-----


Efekt:

Parse error: syntax error, unexpected ';' in /home/accounts_m/maks/public_html/r+/conf.php(97) : regexp code on line 1

Fatal error: preg_replace(): Failed evaluating code: '&lt;a href='.(strpos('php.net.pl/manual/pl/function.substr.php', 'http://') !== 0) ? 'http://php.net.pl/manual/pl/function.substr.php' : 'php.net.pl/manual/pl/function.substr.php&gt;'.(strlen('php.net.pl/manual/pl/function.substr.php')&gt;20) ? substr('php.net.pl/manual/pl/function.substr.php',0,10).'(...)'.substr('php.net.pl/manual/pl/function.substr.php',-10).'&lt;/a&gt;' in /home/accounts_m/maks/public_html/r+/conf.php on line 97
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 27.12.2025 - 08:54