Not sure if this has been asked but what's the best way to combine three strings into one string. I tried adding an array but it didn't work.
My strings are:
$linktitle = get_the_title();
$linkt = substr($linktitle, 0, strpos($linktitle, ' —'));
$linkt2 = substr($linktitle, 0, strpos($linktitle, ' –'));
$linkt3 = substr($linktitle, 0, strpos($linktitle, ' |'));
Example $linktitle outputs:
Facebook Creates YouTube-Like Video Feature Inside Facebook | Re/code WNYC to Open New Podcast Division – The New York Times
My attempt at combination didn't work:
$linkall = substr($linktitle, 0, strpos($linktitle, array(' —', –',' |')));
What I would like to accomplish is combine —, –, and | into an array like in the above example (if possible).
implode()to do this.$linktitleis.