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!

Archived

This topic is now archived and is closed to further replies.

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