Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Memory cleanup isn't free (the instance of $description in scope), and unless you return by-reference, you're making a double copy.


Both versions of the code do exactly the same: 1. Take description from memory 2. Allocate string and put the stripped version there 3. Output the string (here you might save if you don't use output buffering since no copying to the buffer happens but just output) 4. Release the memory allocated in 2.


Whoops, you're right--I was thinking it was getting returned, rather than output.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: