Level 122
I think you have no answers because its not possible to understand your code
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In database
print_r( $result );
Array ( [0] => Array ( [trigger] => {mytext} [alttext] => My text 1 ) [1] => Array ( [trigger] => {mytext2} [alttext] =>My text 2 ) )
$text = '{mytext1} {mytext2}';
$trigger = Trigger::select('trigger', 'alttext')->where('campaign_id', $campaignid)->get();
$result = $trigger->toArray();
foreach ($result as $tdata) {
$tr = $tdata['trigger'];
$ttext = $tdata['alttext'];
$replace = Str::replaceArray($tr, [$ttext], $messagebody);
echo $replace;
}
Result is
{mytext1} My text 2 My text 1 {mytext2}
i want to show result
My text 1 My text 2
Please or to participate in this conversation.