I need to remove some character from string search by value using PHP. I am explaining my code below.
Current Data
$datArr = array(
array(
"name" => "Ram",
"id" => 1,
"date" => "12/04/2017 05:31:57 AM"
),
array(
"name" => "Rahim",
"id" => 5,
"date" => "12/03/2017 12:31:57 PM"
),
array(
"name" => "Raj",
"id" => 4,
"date" => "12/04/2017 05:31:57 PM"
)
);
Expected Output
$datArr = array(
array(
"name" => "Ram",
"id" => 1,
"date" => "12/04/2017 05:31:57"
),
array(
"name" => "Rahim",
"id" => 5,
"date" => "12/03/2017 12:31:57"
),
array(
"name" => "Raj",
"id" => 4,
"date" => "12/04/2017 05:31:57"
)
);
From the above array there is a date
field value and I need to remove the AM/PM
from all date using PHP.
'; $datArr[$key]['date']=str_replace('PM','',$value['date']); } }` . But its not giving the output as per expected. – Dec 05 '17 at 05:37