Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function addCharsAt(int $index,string $char){
- $str='';
- for ($i=0;$i<$this->length;) {
- if ($i == $index)
- $str .= $char;
- else {
- $str .= $this->string[$i];
- $i++;
- }
- }
- $this->length++;
- $this->string=&$str;
- }
Advertisement
Add Comment
Please, Sign In to add comment