Jump to content

Extracting a string from a string - stuck!


ghostwalkz

Recommended Posts

REGEX might be better but this will also work.

 

<?php
$foo = "blahblahblahrandomstuff {youtube}imdKQ3NNnoM{/youtube} moreblahblahblahrandomstuff";

list($before) = explode("{/youtube}", $foo);
list(,$before) = explode("{youtube}", $before);

echo $before;
?>

 

Now you may have to escape the { and } if it gives you an error to be \{youtube\}  but give that a try and see.

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.