Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3442638
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:41:36+00:00 2026-05-18T08:41:36+00:00

I am trying to create a template system for a web site I am

  • 0

I am trying to create a template system for a web site I am working on. I am trying to use preg_replace to call a function to process data that is surrounded by certain tags. For example, process(‘date’) would return today’s date, and is put in the code as $date$. I am using preg_replace to find the strings I need to modify, but I can not call the function – PHP seems to think that the function is a property instead.

This is the code I am using:

$view = preg_replace("/\$_([a-zA-Z0-9_]+)_\$/e", "$this->process('\\1')", $view);

This is the error I get:

Notice: Undefined property: ClassName::$process in /location/ClassName.class.php on line X

I hope I explained this sufficiently. How do I get preg_replace to execute process as a method, instead of trying to display it as a property?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:41:37+00:00Added an answer on May 18, 2026 at 8:41 am

    I would suggest using preg_replace_callback instead of preg_replace seeing as preg_replace_callback is designed for what you are actually trying to do. A possible issue you could be having is scope/function accessibility. If your code that is calling preg_replace doesn’t have access to the function you are trying to call, then you could be getting this error since PHP can’t find the function and might be defaulting to treating it as an parameter. If the function isn’t in the same file as this preg_replace, try putting it there to see if it changes anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a web application project template for everyone to use here
I am trying to create a template that will put items in a table.
I'm trying to create a feature that both creates a list template and an
I'm trying to use Subsonic 3.0.0.3 with an existing web site created in vb.net.
After flailing around for days trying to create a hybrid installer ( System.Data.Sqlite.dll is
OK, so I'm trying to create a template item from a web form. I
I'm trying to create an xml-based template system. The idea is to return my
I am trying to create a multi project template. I wish the sub projects
I'm trying to create a generic build template for my Makefiles, kind of like
I'm trying to create a perfectly circular button, So I created a template from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.