[Terrible Idea] Using the same function to set/get a string
You shouldn't do this as it's pointless and ugly, but I put this together because I was interested in the idea. The Name function can be used to set or get a string, depending on what parameter you pass to it.
PHP Code:
|
Re: [Terrible Idea] Using the same function to set/get a string
Well done, you made me puke!
|
Re: [Terrible Idea] Using the same function to set/get a string
That's the worst piece of code on this forums
|
Re: [Terrible Idea] Using the same function to set/get a string
Where do I collect my award?
|
Re: [Terrible Idea] Using the same function to set/get a string
The thing you set to name is hardcoded...
|
Re: [Terrible Idea] Using the same function to set/get a string
Correct! It is temporarily set to a hardcoded value before being overriden by the Name function. I did warn you: "terrible idea". Just a little 'what if' concept that shouldn't actually be used.
|
Re: [Terrible Idea] Using the same function to set/get a string
Why not just use a blank string
|
Re: [Terrible Idea] Using the same function to set/get a string
Because you might want to set the string to a blank string.
|
Re: [Terrible Idea] Using the same function to set/get a string
Why not pass string max length as always (default value = 0) and in the function check:
if the length is > 0 - Get if the length is <= 0 - Set PHP Code:
|
Re: [Terrible Idea] Using the same function to set/get a string
Yeah that would be slightly less insane.
|
| All times are GMT -4. The time now is 18:55. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.