function categoriesIdsFunction($ids){
//I try with preg_replace remove if exists all character before _
$ids = preg_replace('/^[^_]*_\s*/', '', $ids);
$ids = preg_replace('/\s+/', '', $ids);
return "in ('" . str_replace(",","','",$ids) . "') ";
}
$categories_in_article = "267,267_463,267_462";
$categories_in_article_return = categoriesIdsFunction($categories_in_article);
With my code I take this: in ('463','267_462'), I try with preg_replace remove if exists all character before _ ($ids = preg_replace('/^[^]*\s*/', '', $ids);)
I need this return: in ('267','463','462')