Jump to content

Using recursive structure to handle encapsulated code


lwc

Recommended Posts

If one wants to modify internal code segments before modifying external ones, there's a proof of concept of it in Example #3 of preg_replace_callback(). However, it only deals with just one tag. Can you think of a way to expand it to multiple tags?

 

Also, not with BB code but actual <custom code>.

 

For example,

$input = "Hi, this is <custom_code1>just <custom_code2>my</custom_code2> <custom_code3>example</custom_code3></custom_code1>.
How can it <custom_code4>get <custom_code5>done</custom_code5></custom_code4>?";

 

Another function does different things for what's inside each of the custom codes. Basically codes 2 & 3 need to run before code 1 can, and code 4 needs to run before code 5 can.

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.