Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. You can achieve this with some simple math. Something like this should work: $arr = array('Branda', 'Tara', 'Tom'); echo 'Bug checker this week: ' . $arr[(date('W') == 1) ? 2 : date('W') % sizeof($arr)];
  2. There's already a thread for this. See here: http://www.phpfreaks.com/forums/index.php/topic,58799.0.html
  3. You have to either escape the double quotes in the string you're trying to echo, or use single quotes with the echo instead. The latter is easier: echo '<img src="icons/Doors.png" width="32" height="32" border="0">'; I also suggest that you don't use short tags because it will just cause you headaches in the future.
  4. 1. You're still using mysql_db_query() there. 2. You're naming only 2 columns and providing 3 values.
  5. The entire jQuery framework is only about 24KB (when compressed).
  6. All the else statements that don't have braces that I see should work fine because you're only executing one statement on that condition, so I think your problem is somewhere else. Personally, even if I only need to execute a single statement on a certain condition I opt to leave the braces there. I find that it makes things look a lot neater.
  7. Alex

    Array

    foreach($arr as &$val) { if(substr($val, 0, 1) == "+" || substr($val, 0, 1) == "@") { $val = substr($val, 1); } }
  8. If it works what kind of thought are you looking for?
  9. Alex

    $_GET

    http://www.roscripts.com/Pretty_URLs_-_a_guide_to_URL_rewriting-168.html
  10. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=308166.0
  11. The profile() method would have to return an object that has a public property named weirdname.
  12. I realize that my first solution wasn't the best because it wouldn't turn Z into A. Here's a better solution: for($i = 0, $n = strlen($text);$i < $n;++$i) { $val = ord($text[$i]); if($val > 64 && $val < 91) { $text[$i] = chr((($val - 64) % 26) + 65); } else if($val > 96 && $val < 123) { $text[$i] = chr((($val - 96) % 26) + 97); } } You could probably even shorten that, but in terms of readability that's more clear.
  13. Here's one way to do it: for($i = 0, $n = strlen($text);$i < $n;++$i) { $val = ord($text[$i]); if($val > 64 && $val < 122) { $text[$i] = chr($val + 1); } }
  14. Alex

    $_GET

    What you want is mod_rewrite and pretty URLs. Just Google it and you'll find plenty of results with examples on how to implement it.
  15. You would have to do something like this: class Parsers { public $Imdb; function __construct() { $this->Imdb = new Parsers_Imdb_Imdb; } }
  16. This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=308051.0
  17. You're missing the point of PHP. This is something for CSS.
  18. You have nested foreach loops or what? Just make sure that the variable you're performing the foreach on is an array using is_array.
  19. Use break; to break out of a loop. foreach(...) { if(...) { break; } }
  20. You're not even using $msg in the function, so why are you passing in that parameter? Just remove it. function siteonline(){ siteonline(); I doubt that's your problem though. More likely than not it's just throwing an undefined constant warning and assuming string "n". Are you sure that $offline contains what you're expecting?
  21. For more alternatives to ORDER BY RAND() see this post.
  22. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=307735.0
  23. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=307532.0
×
×
  • 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.