Jump to content

aximbigfan

Members
  • Posts

    329
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

aximbigfan's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. 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
  2. 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
  3. Never mind. I figured it out. Chris
  4. 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
  5. 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
  6. http://tinyurl.com/PHP-Parse
  7. 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.
  8. You will have to put it in a .php file, otherwise it may not be parsed. Otherwise, I think that's it.... Chris
  9. 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
  10. Actually, he might want to create some sort of REST service for the apps to connect to, rather than connecting directly to MySQL. Chris
  11. 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
  12. I figured he was saying building it from scratch. Just soldering a kit together is easy, if you know how to solder. Chris
  13. @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
  14. 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
  15. 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
×
×
  • 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.