newbtophp Posted October 14, 2009 Share Posted October 14, 2009 How would i replace: (); if its on its own line, without effecting other code, i tried str_replace but that would replace other code even if its not on its own line, for example: <?php include_once("application.php"); (); $account = new Account(); (); $accounts_4_sale = new ProductListing(); $limit = RECORD_PER_PAGE; $start = isset($_GET['pagenum']) ? ($_GET['pagenum'] - 1) * $limit : 0; (); $content = new Content(); include_once(THEME_PAGES_DIR."page_structure.html"); ?> Would turninto: <?php include_once("application.php"); $account = new Account(); $accounts_4_sale = new ProductListing(); $limit = RECORD_PER_PAGE; $start = isset($_GET['pagenum']) ? ($_GET['pagenum'] - 1) * $limit : 0; $content = new Content(); include_once(THEME_PAGES_DIR."page_structure.html"); ?> All help greatly apreciated Quote Link to comment https://forums.phpfreaks.com/topic/177675-solved-replace-a-character-new-lines/ Share on other sites More sharing options...
nrg_alpha Posted October 14, 2009 Share Posted October 14, 2009 Perhaps a pattern like: #^\(\);\s*$#m ? Quote Link to comment https://forums.phpfreaks.com/topic/177675-solved-replace-a-character-new-lines/#findComment-936838 Share on other sites More sharing options...
newbtophp Posted October 14, 2009 Author Share Posted October 14, 2009 Thanks worked nicely Quote Link to comment https://forums.phpfreaks.com/topic/177675-solved-replace-a-character-new-lines/#findComment-936853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.