Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by requinix

  1. Emphasis on "think". The nicest thing arrow functions have to offer is implicit variable binding. $a = 1; $add = fn($b) => $a + $b; // function($b) use ($a) { return $a + $b; } echo $add(2); // 3 The bad thing is that the binding is strictly by-value. As in a regular use() and by a by-ref use(&). Which means it's very much not like how Javascript works (which goes by scope, not bindings). $a = 2; echo $add(2); // 3 because $add still thinks $a=1 var a = 1; var add = (b) => a + b; console.log(add(2)); // 3 a = 2; console.log(add(2)); // 4
  2. If they have an API that does what you need then that's going to be the best way to go. Even if it's not the greatest. Because scraping stuff correctly and accurately is difficult. Disable your antivirus's web scanning part and (carefully) try viewing the docs again?
  3. array_reduce is a great function for this. Quite rare to see it in the real world, which means bonus points for actually using it. $numbers = array(1, 3, 7, 8, 10, 13); // assuming there is at least one even number >= 0 $max = array_reduce($numbers, function($max, $n) { return ($n % 2) == 0 && $n > $max ? $n : $max; }, 0); Or with PHP 7.4's arrow functions, $max = array_reduce($numbers, fn($max, $n) => ($n % 2) == 0 && $n > $max ? $n : $max, 0);
  4. requinix

    stuck block

    If you want a simple animation like to move to the top and bottom every 2 seconds then CSS's animations can do it better.
  5. Ohh, okay, that's what you meant. Can you upload a sample of what it produces?
  6. If you want Windows to use the built-in ZIP handler then you need to tell Windows to use the built-in ZIP handler. PHP has nothing to do with it.
  7. I wonder if the typo near $to_name is to blame...
  8. Controllers drive views, so if there are admin views then you'll probably want one or more admin controllers. Models are mostly for database tables, so if there are admin tables then you'll want admin models. If that's similar to how you're arranging the rest of the views in your application then continuing to do so sounds like a good idea.
  9. Maintenance complete, took about 1.5 hours. The IPB upgrade reverted a couple template changes that I'll re-evaluate sometime tomorrow later today.
  10. Yeah, this is not something that a couple posts on a forum is going to solve. You're talking about integrating with some website's API. There's documentation to read, instructions to follow, possibly a developer account or API key to obtain... We can still help but you're going to have to do a fair bit of work even to get the ball rolling here. The first question you need to answer is what, technically speaking though not in terms of literal PHP code, is what your site needs to do. What data goes where and how. Translating that into PHP comes after.
  11. Either I'm misunderstanding or you're talking about completely changing what this process does. And while you may not know PHP, you still have two options here: we help do you the work (which will require you to learn some PHP) or you find someone who'll do it for you (and it won't be free). Assuming the former, What website are you talking about? Send what data that was presumably combined into $message?
  12. Yeah, basically. I'll put up a warning before I take stuff down, but exactly when that will happen I'm not sure yet. Probably around midnight PDT.
  13. If you have the same question then why don't you read maxxd's reply to it?
  14. Don't do that. Make a page specifically for the AJAX request that "calls" the snippet. And just stick with .php. It's more portable, both for running and for editing. If you want your snippets (I term I hate, by the way) to be separate then put them in a dedicated directory or something.
  15. ...but look at what happens when answered threads don't get removed: the discussion continues. We don't close threads just because OP got their answer - we're not StackOverflow. You never know what else might arise after the problem is supposedly "solved".
  16. What date? Why was it July 19 before and June 26 in your latest post? What is this UPDATE query about? Remember that you're the only one who really knows what you're working with. We need more to be able to catch up enough to help. Context. Background information.
  17. Simple answer with an options array: public function __construct(array $defaults = []) { $this->defaults = $defaults; } public function whatever(array $options = []) { $options += $this->defaults + [ "foo" => "bar" ]; // $options["foo"] comes from $options if set, or else $this->defaults if set, or else is your own default }
  18. You forgot the part of the post where you say what it is that you need help doing.
  19. Maybe it's just me but why not SELECT entry_id, user_id, votes FROM contest_entries WHERE contest_id = :contest_id AND category_id = :category_id AND e_status = :e_status ORDER BY votes DESC LIMIT 1
  20. Find the configuration and change it to allow your extensions. If you don't want to bother because you don't happen to remember exactly what it is you need to change or where then give up and do something else with your time.
  21. mod_php and php-fpm work differently. For the former it's in the server configuration, for the latter it's in the site configuration.
  22. Apache doesn't magically know that .php files go through PHP. That has to be configured. And the very same configuration that says the .php extension goes through PHP can be modified to say that other extensions do too.
  23. What is the code to come up with the original data? Might it be easier to adjust that to not return/include the zero values?
  24. WSDLs are also helpful on the server side for much the same reasons, so it'd be surprising if they didn't have one. It's also fairly standard for SOAP to publish them because they're so helpful. Does http://legit.com/endpoint/givenlocation.asmx?wsdl happen to work?
  • 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.