3 ms·
I doubt it even sacrifices performance. The temporary results of strip_tags() still has to be allocated in order to be echo'd out -- so you're using the same a
by wvenable 15y ago
I doubt it even sacrifices performance. The temporary results of strip_tags() still has to be allocated in order to be echo'd out -- so you're using the same amount of memory. $description will be de-allocated as soon as it goes out of scope.
- johnx123 15y agoAgreed. Should be: $stripped_description = strip_tags($_POST['description']); echo $stripped_description;
- eropple 15y agoMemory cleanup isn't free (the instance of $description in scope), and unless you return by-reference, you're making a double copy.
- smalyshev 15y agoBoth 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.
- eropple 15y agoWhoops, you're right--I was thinking it was getting returned, rather than output.