How could I replace the name and YYY ZZZ, AA, BBB, etc. for the same number of letters generatedby some string generator? ZZZ example would be replaced by the Qj3 and e.g. DDaa be replaced for hT4y etc... .-----------------====-------------------------== ===--. |-=[ U S E R T O P ]=---------------. | | `-----------------====----------| | 1 ZZZ/iND 200.3M 14F 46.8% 80461KBs | | 2 YYy/iND 70.7M 5F 16.5% 46622KBs | | 3 Aa/iND 57.2M 4F 13.4% 49353KBs | | 4 BBB/iND 28.6M 2F 6.7% 32796KBs | | 5 Ccc/hidden 28.6M 2F 6.7% 67702KBs | | 6 DDaa/iND 28.6M 2F 6.7% 63206KBs | | 7 DSQ/iND 14.3M 1F 3.3% 12795KBs | |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | | 7 Total 428.4M 30F 100.0% 63269KBs | `-----================---------------------------==------------------' Code (markup):
here is the simple preg_replace example that may work for you. <?php $string = 'ZZZ'; $pattern = '(Z{3})'; $replacement = 'Q3j'; echo preg_replace( $pattern, $replacement, $string ); ?>