aximbigfan
Members-
Posts
329 -
Joined
-
Last visited
Never
Everything posted by aximbigfan
-
So I have these variables... $curtz // Timezone I want to convert to (example "-0600") $date['TZ'] // Timezone of the time I want to convert to $curtz (example "-0800") $date['D'] // Day (example "8") $date['M'] // Month (example "1") $date['Y'] // Year (example "2009") $date['H'] // Hour (example "23") $date['Min'] // Minute (example "59") $date['S'] //Second (example "59") And I have this horrible code... if ($curtz!=$date['TZ']) { $direction = substr($date['TZ'], 0, 1); $hours = substr($date['TZ'], 1, 2); if ($direction=='+') { $date['H'] = $date['H'] - $hours; if ($date['H']<0) { $date['H'] = $date['H'] + 23; $date['D']--; } } else { $date['H'] = $date['H'] + $hours; if ($date['H']>23) { $date['H'] = $date['H'] - 23; $date['D']++; } } $direction = substr($curtz, 0, 1); $hours = substr($curtz, 1, 2); if ($direction=='+') { $date['H'] = $date['H'] + $hours; if ($date['H']>23) { $date['H'] = $date['H'] - 23; $date['D']++; } } else { $date['H'] = $date['H'] - $hours; if ($date['H']<0) { $date['H'] = $date['H'] + 23; $date['D']--; } } if ($date['D']>$this->months[$date['M']][1]) { $date['M']++; if ($date['M']>12) { $date['M'] = 1; $date['Y']++; } $date['D'] = 1; } elseif ($date['D']<=0) { $date['M']--; if ($date['M']<=0) { $date['M'] = 12; $date['Y']--; } $date['D'] = $this->months[$date['M']][1]; } } Yes, I know, the above code is disgusting, and probably doesn't work right. Can anyone give me some pointers on how to fix this, or a better way of converting times between timezones? Thanks! Chris
-
echo '<a href="$var1">$var2</a>'; why won't this work?
aximbigfan replied to Aro2220's topic in PHP Coding Help
Single quotes are simple strings, and will to be parsed by PHP. Double quotes will be parsed. $var = 'no vars here'; echo 'The var is $var'; // Will output: The var is $var echo "The var is $var"; // Will output: The var is no vars here -
Never mind. I figured it out. Chris
-
Hi, I need someway to write hex to a file. Like this: file_put_contents('file.txt', "\1b\2a"); will put "<escape char>*" into file.txt Any ideas? Thanks, Chris
-
I made my own database server............ Out of PHP in CLI. I coded a system to change my desktop wallpaper with one in a MySQL databse, in such a way that all wallpapers are selected an equal number of times. I have 4 servers in my room. 3 embedded ARM9/MIPS and one X86. I rated myself a 10. Chris
-
[SOLVED] need help T_STRING error, Help please someone!!
aximbigfan replied to jamesxg1's topic in PHP Coding Help
http://tinyurl.com/PHP-Parse -
Hey James, get a clue! Your probably one of those people who goes around self diagnosing yourself with "ass-burgars". I seriously doubt you have it, instead, I think you have a bad case of mental retardation. Go read a tutorial, get somewhat good, then ask for help. Quit trying to get spoon fed. All your code samples are awful. Learn to make useful comments (not "// some code"), and keep your stuff consistent.
-
You will have to put it in a .php file, otherwise it may not be parsed. Otherwise, I think that's it.... Chris
-
Trying to write a simple/maybe not so simple ping script
aximbigfan replied to djetaine's topic in PHP Coding Help
This needs to be done from the client side, not with PHP of JS, etc. Look at Visual Basic. you can download the express version for free from MS. Chris -
Actually, he might want to create some sort of REST service for the apps to connect to, rather than connecting directly to MySQL. Chris
-
You don't up an build an MP3 player from scratch without any experience. The kid is only going to get frustrated. Get a kit! Learn to solder! Chris
-
I figured he was saying building it from scratch. Just soldering a kit together is easy, if you know how to solder. Chris
-
@Corbin, I would have to agree, at least from a logical standpoint. Anyone wanna give this a shot on an older version of PHP (blatent rip off of Corbin's) function RetArr() { echo "Function Run"; return array (1, 2, 3); } foreach (RetArr() as $val) { echo $val; } On PHP 5.2.4 I get "Function Run123" which is expected. Chris
-
Which one of these method is the better way? (IE, more efficient) // Method one $str = '1|2|3|4|5|6'; foreach (explode('|', $str) as $key=>$val) { //Do something here } // Method 2 $str = '1|2|3|4|5|6'; $arr = explode('|', $str); foreach ($arr as $key=>$val) { //Do something here } Normally, I just use method 1. Will PHP run that function every alliteration, or will it run it once, and cache the array? I would think it would just cache the array... Thanks, Chris
-
You don't need a gun to commit a 'bad crime', which is a relative term anyway. Ppl who suffer from rage are extremely dangerous. Thats why personal guns need to be banned.....i mean buying a gun at wallmart WTF!! How many ppl do you know who flip out over minor shit?? http://au.youtube.com/watch?v=7Sq-HYGfnIo Imagine if this was a gun and not an axe... You're logic doesn't make sense in the least. When you outlaw guns, only outlaws have them. Crime would run rampant since criminals would get guns, and people would be defenseless. Chris
-
If you don't know where to get the parts, I can assure you you will not find this at all easy, and most likely, imposable. Chris
-
The new OM? Get rid of the green! It is awful! Chris
-
If in CMD line, PHP will output each echo. If in a webserver, the content will not be sent to the browser until the script is done. Chris
-
Why did you feel the need to post this?
-
Welp, this topic is progressing nicely. Like a fine wine it only gets better with age
-
Some colors are ok, like blue, since it is often used in emails. But like red, or brown, yeah, no. I do agree with the point about this being an English board, and that if people are going to post on it, they need to least know a degree of English. Chris
-
I don't think that this should be home of the grammernazi or anything, but I do think that it may be good for the community to put new users on "probation" where there is some sort of reminder of an acceptable format of posting. Chris
-
Sure! This is the best way I have found. It also allows me to mod a bunch of keys at once, plus, 3d arrays! Chris
-
Could some mod maybe make a sticky out of a thread asking people to PLEASE USE PROPER ENGLISH? and while were at it, a proper guide to posting? I'm constantly seeing threads where people vomit all over the English language, and when I see these, I immediately click back. I don't know if there is a formatting guide out there now, but here is one that I made up Don't post in all CAPS Don't give people a time line to help you. Everyone on this forum is a volunteer. If you want things done ultra quickly, hire a programmer Don't abuse similes. One or two is fine, but no long strings of them Do SEARCH before you post Do spell check before posting Don't bold/italicize/underline your entire post Do post relevant code! Don't abuse font sizes/color Thanks, Chris
-
I can haxks your lunix!