Jump to content

Turn this code into a function?


Mr Chris

Recommended Posts

Hello All,

 

I'm trying to put a lot of what I do into function calls now to make my code a bit tidier and consise.  Take this simple if statement:

 

if ($_GET['thedate'] =='') {
$var = date('l, jS F, Y',time());
} else {
$var = date('l, jS F, Y', strtotime($_GET['thedate']));
}

 

How could I put this into a function and in some kind of switch statement?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/216493-turn-this-code-into-a-function/
Share on other sites

@Pikachu2K, You made me laugh

@ignace, yes I thought English was your native language, but now in my mind when I read your posts, your voice sounds like Stevie Hawkins

 

@Mr Chris, Did you even try to use a switch statement in a function before posting?

Of course you can use switch in a function.

 

Q. Are you the same Mr Chris from sheffieldforum.co.uk?

@ignace, yes I thought English was your native language, but now in my mind when I read your posts, your voice sounds like Stevie Hawkins

 

At least my English teacher can be rest assured that she did a good job on the writing part :) Not sure how Stevie Hawkins sounds but I'm not that old :)

Sorry Steven Hawkings...

 

http://www.youtube.com/watch?v=HZkyRl5IreM

 

@ignace, yes I thought English was your native language, but now in my mind when I read your posts, your voice sounds like Stevie Hawkins

 

Isn't it annoying for you to always have to speak through my voice?

Thing is I hear Dutch a lot of the time because i'm a keen Blender user and the majority of tutorials are by Dutch peeps (since it's primary developer base and institute is there).

 

I always imagine / copy voices of people, it the animator in me.

 

... On another note, Steven Hawkings voice could be updated to be a lot more natural, but he prefers it because it is now a part of him...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.