Jump to content

Search the Community

Showing results for tags 'preg_replace_callback'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. can someone help me change this to preg_replace_callback. i'm receiving the following error Warning: preg_replace_callback(): Requires argument 2, '@constant("\1")', to be a valid callback in //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);
  2. Hello , i built php class for parsing html templates , and i used preg_replace_callback function for parsing template while loops & if conditions , for loop , ... etc i repeated the function many times , for every process , such as one time for parsing while loop , and another time for if conditions parsing .. etc , and repeated all of these steps again when parsing include files inside the template , but i think that this method of parsing is slow when parsing big template , so i think that using one while loop and read template line by line and compare it then parsing found line will be more fast , so what is your opinion , using one while loop and read the template file line by line and parsing it is more useful ? or using preg_replace_callback ? and is it preferred to parse the codes inside the template ? by replacing it with php code then evaluate the template using eval() ? or parsing it inside the php file then append the result to the template ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.