Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Instead of printing the data in database.php just store the result you want in a variable, then on index.php include database.php and echo the variable you used to store it.
  2. You should post the code. Are you trying to pass a resource returned by something like fopen()? As the error states, you're supposed to pass the filename (String) of the file, ex: someimage.jpg, not a file resource.
  3. I feel like we're going in circles. The function already removes the two lowest elements. That's the point of 'array_shift($arr); array_shift($arr);'. The array is already sorted from lowest to highest and array_shirt() removes the first element. Alternatively you could use do array_splice($arr, 0, 2);
  4. Don't we already have enough problems with people not being able to articulate their problems in the help forum(s)?
  5. Then just round the return using round()? function getAverage($arr) { asort($arr); array_shift($arr); array_shift($arr); return round(array_sum($arr) / count($arr)); }
  6. Your problem is that you're searching for the array $wgt_places, not each element separately. So it would work if your array looked like this: $wtg_places = array(array('all', 'index')); To get the functionality that you want you can do this: foreach($places as $place) { if(!in_array($place, $wdt_places)) { echo "$place was not found<br />\n"; } } Or if you want a single function just to check if all the elements of $places are in $wgt_places something like this will work: function ein_array($search, $array) { $found = true; foreach($search as $element) if(!in_array($element, $array) $found = false; return $found; }
  7. The function that I originally posted for you to use includes this functionality.
  8. Yes it can be done. Depending on if you know exactly what you're searching for or not you might need to use PCRE functions, but for your specific example you could use strpos(). Example: if(strpos($content, '<h1>This is my website</h1>') !== false) { echo 'Found!' }
  9. You need to make your regular expression lazy by adding a ?, /<p>(.+?)<\/p>/
  10. More likely it's a problem with your cache. Just tried it on FF, works fine for me.
  11. I offer help in whatever ways I can.
  12. You're receiving that error because of this line: $allfishes[] = array(); In that line you're not making $allfishes an array, rather you're making the first element of $allfishes and array. Just remove that line (because it's not even required) and you should be fine. Edit: You're also missing a $ on this line ( and the other line like this ): obj1->setName("First Fish");
  13. Yea, why not just do: echo str_replace("\n", " ", $about);
  14. You shouldn't be using PCRE functions when you don't need to, they use a lot more resources than you need to waste. Instead use str_replace(). The reason why it's only replacing br / is because preg_replace is trying to use < and > as delimiters. echo str_replace("<br />", " ", nl2br($about));
  15. Normally just closing the browser will end a session, although it does on certain settings.
  16. Alex

    Google Wave

    Yea, my first wave was cool But it gets pretty boring because well.. it's so empty. But it'll be great once it's public and everyone has one.
  17. Alex

    Google Wave

    Final got my invite
  18. To get rid of the src=" you could just do $img = substr($matches[0], 5), but ideally you should get a better regular expression.
  19. Can you preform print_r($matches) before array_map and post the results please.
  20. MD5 cannot be reversed, that's the point.
  21. Wow, I must not be thinking.. I feel really stupid for not realizing that..
  22. I'd go with sessions. They're stored on the server so they're secure. Cookies are insecure, flatfiles and databases are going overboard for something so trivial.
  23. His background image probably includes the border, and each character is probably drawn separate rather than in a single string.
×
×
  • 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.