I have the following short codes:
Dear {{name}}
,
You are being invited for the following event: {{event}}
regards, {{author}}
I have an array from the database :
$data
where:
$data['name'] = 'John Doe';
$data['event'] = 'Party yay!';
$data['author'] = 'Kehke Lunga';
Output that I expect:
Dear John Doe,
You are being invited for the following event: Party yay!
regards, Kehke Lunga
also, I also want to perform operations like {{firstname||lastname}}
which should either check if key $data['firstname']
is set, if it isn't it should use $data['lastname']
. However, that is for later stage.
For now, I just want to know how to match the text between 2 curly braces.
Thanks
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…