<?php // your code goes here$ar = array('1','2','3','4'); array_walk( $ar, function (&$s, $k, $prefix = 'aaa') { $s = str_pad($s, strlen($prefix) + strlen($s), $prefix, STR_PAD_LEFT); }); var_dump($ar);
Standard input is empty
array(4) { [0]=> string(4) "aaa1" [1]=> string(4) "aaa2" [2]=> string(4) "aaa3" [3]=> string(4) "aaa4" }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!