I am not familiar with preg_replace function of php. I need to solve an issue by using this function.
My string is sidebarCond/none.php. I need to remove folder name whatever it is (like: sidebarCond/ or folder-name/) and also the extension (Like: .php or .html).
$sidebar = 'sidebarCond/none.php';
$sidebar = str_replace( 'sidebarCond/', '', $sidebar );
$sidebar = str_replace( '.php', '', $sidebar );
This is the code of how I solve my problem, but this is not a smart solution.
basename
likely being the simpler alternative.