Hello, there is a simple code I'm writing but can't find exactly where I'm going wrong.
$data = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis eget tellus cursus, ultrices justo at, ultricies libero. Vivamus consequat ante vel nunc dapibus, non tempus elit vehicula. Nulla facilisi. Proin leo urna, congue eu justo eget, viverra mattis lacus.
#otwquote";
preg_match_all('/\s#otw[0-9a-z]+\b/i', $data, $matches);
$matchtag = str_replace("#otw", "", strtolower($matches[0][0]));
echo $matchtag;
$formats = array("status", "aside", "link", "gallery", "image", "audio", "video", "quote", "chat", "standard");
$backhash ="standard";
// here $matchtag = "quote"
if ( in_array ( $matchtag , $formats ) ) {
echo $matchtag;
} else {
echo $backhash;
}
Now when I'm using
if ( in_array ( "quote" , $formats ) )
It's working fine. But with variable $matchtag it's returning false.
Please help.
Thanks