Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
09-01-2015, 06:24 PM | #1 |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
PHP preg_replace_callback help needed
trying to avoid going on stackoverflow don't want to deal with the Q&A ego police that mod that site. Any i'm getting this error Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in any assistance greatly appreciated
Code:
//load current language foreach ($langs as $key => $value) if ($value['l_code'] == lang) break; $f = fopen('languages/'.$langs[$key]['l_file'],'r') or die('Cannot open language file '.$langs[$key]['l_file']); while (!feof($f)) { $s = chop(fgets($f,4096)); if ($s{0} == '#') continue; list($key,$value) = explode('=',$s,2); $value = preg_replace('/<%(.*)%>/sUe', '@constant("\\1")', $value); $def[$key] = $value; } fclose($f); |
09-01-2015, 06:37 PM | #2 |
I'll make you famous
Industry Role:
Join Date: Oct 2002
Posts: 13,955
|
I don't deal with preg_replace that often but after spending a couple of minutes looking at preg_replace_callbak I am thinking that something like this will work:
$value = preg_replace_callback('/<%(.*)%>/sU', function(){ return @constant("\\1"); }, $value); Worst that can happen is it won't ;p edited in: also remove the e modifier I think. I forgot to do that originally. . |
09-01-2015, 06:48 PM | #3 | |
Confirmed User
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
|
Quote:
|
|
09-01-2015, 07:00 PM | #4 |
I'll make you famous
Industry Role:
Join Date: Oct 2002
Posts: 13,955
|
|
|
|||||||
Bookmarks |