I have this array:
$form = array(
array(
"type" => "text",
"value" => "
Hello @name
How old are you? @age
How are you today? @condition"
),
array(
"type" => "font",
"family" => "Arial",
"size" => 6,
"weight" => "Bold"
)
);
Then I did this json_encode($form) and It has this output:
[
{
"type":"text",
"value":"\r\n Hello @name\r\n\r\n How old are you? @age\r\n \r\n How are you today? @condition"
},
{
"type":"font",
"family":"Arial",
"size":6,
"weight":"Bold"
}
]
The thing is json_encode() also acts like a string so I can also do like this:
$old = array('@name','@age',@condition');
This $old data is what I will put in the str_replace();
But I want to do it in an array form like get all data with @ symbol.
Can we do that with pregmatch? or is there any other way to do it?
str_replaceyu can pass array as well.@signs on it