Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


NotionCommotion last won the day on July 2 2019

NotionCommotion had the most liked content!

Community Reputation

30 Good

About NotionCommotion

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Is there a better way to have array_intersect_key() return only non-NULL values? Thanks function stripAssociatedArray(array $array, array $keys, bool $removeNull=false):array { $array = array_intersect_key($array, array_flip($keys)); return $removeNull?array_filter($array, fn($value) => !is_null($value)):$array; }
  2. Are you not getting the appropriate output? If so add some test to validate what you are seeing. $stmt = $ConnectingDB->query($sql); print_r($stmt->fetchAll()); Or are your links not working? Has to do with your JavaScript. <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol>
  3. I would do it this way $countries = array_intersect_key($countries, ['US'=>null, 'CA'=>null]); unless I wanted to be super tricky in which I would do it this way $countries = array_intersect_key($countries, array_flip(['US', 'CA'])); gizmola's way is defiantly more tricky than mine.
  4. Thanks benanamen, While it is typically hardcoded , suppose so is a config.ini or config.json file, and as long as a single dedicated file, makes perfect sense to me. Ah, didn't think of dotenv, and think it could be a great approach as well.
  5. Every now and then, I experience some strange behavior and eventually trace it back to parse_ini_file's scanner_mode being applicable to some parameter but not another, and am looking for alternatives. Below are several of my thoughts. How do you store configuration settings? Do you use different approaches based on the application, and if so what criteria governs which you use? Keep with a ini file with parse_ini_file. Obviously, not working for me. An ini file but with a class dedicated to ensuring the data is appropriate. Seems like too much duplicating content which will r
  6. Oops. Looked for a way to delete my 3v4l post or even ask someone to do so, but no luck. Wednesday 2020-09-02 01:02:03 to Friday 2020-09-04 04:05:06 is the closest to the gap.
  7. Try these dates Fill Wednesday 1978-09-27 12:34:56 -> Tuesday 2020-09-08 12:34:56 Gap Wednesday 2020-09-09 01:02:03 -> Friday 2020-09-11 04:05:06 New Wednesday 1978-10-04 01:02:03 -> Friday 1978-10-06 04:05:06 When I view your link, I see one output, but with mine, I see dozens. Your output: My Output
  8. Hi requnix, Yes, saw it. I like yours more than my original version as it is more concise, but I think it doesn't select the right dates if the fill range is earlier than the gap range. Any slicker ways to do it, or just put some if fill > gap, do what you show, else do something similar as necessary? By the way, how do you set https://3v4l.org/0RJfq up so it does not try every version of PHP? Of topic, but your solution provides different results if given DateTimeImmutable instead of DateTime. If this wasn't just a quick example, would you typically write script which would w
  9. Oops! Looks like I failed to say that new fill must also match the gap's duration. Sorry bout that. What had been originally messing me up were these two lines (but my original posted showed the DateInterval as being commented out as it didn't work). I create a DateInterval for my desired duration, determine either the appropriate modified fill start or end date, and then get the other associated modified fill date by applying the gap DateInterval, and it mostly works but not always. $fillStartModified = $fillEndModified->sub($gapStart->diff($gapEnd)); $fillEndModified = $fi
  10. You mean you can't read my mind to gain an understanding of how I define those words? Sorry requinix, my bad. Typically with PHP, we consider time the combination of the day/month/year plus the seconds past midnight, but for this application I am defining "WeekDayTime" as the day of the week (D) plus the seconds past midnight. For instance, Examples #1 to #4 are not the same WeekDayTime as Thu 2019-01-10 13:34:25 because the day of the week is different, #8 is not the same because the seconds past midnight are different, but #5 to #7 are the same because they both have the same day of t
  11. Say I have a fill from January 1st to January 31st and from April 1st to April 30th. Don't have a calendar in front of me to confirm the week days, but if I had a gap from February 10th to the 12th, the closest would be latest time in January which ends on the same time/week as the February 12th gap end, and if I had a gap from March 20th to 22nd, the closest would be the earliest time in April which starts on the same time/week as the February 10th gap start.
  12. My birthday and anniversary? Wait, there's more dates. Been wanting a larger family and all my recent children's birthday?
  13. Well, turns out the FDA will be stopping by later today to audit our 21 CFR Part 11 drug production facility and ... Just kidding, nothing unethical or illegal.
  14. I wish to find the closest two DateTimes which are within $fillStart and $fillEnd and have the same week and 24 hour times as $gapStart and $gapEnd. For instance, the following results in $fillStartModified and $fillEndModified which meets that criteria. fillStart 2019-07-23 00:15:00 Tue fillEnd 2019-09-23 13:00:00 Mon gapStart 2019-05-23 00:15:00 Thu gapEnd 2019-06-23 13:00:00 Sun fillStartModified 2019-07-25 00:15:00 Thu fillEndModified 2019-08-25 13:00:00 Sun I came up with the following which seems to work, but it is kind of c
  15. Steven, See below. Also, you probably want to make a HTTP POST request instead of GET. if(isset($_GET['post'])){ // bla bla bla $row=mysqli_fetch_array($result); } ?> <!-- What if $_GET['post'] wasn't set? Will $row be defined? --> <content> <?php echo $row['Website']?> <?php echo $row['UcasPointsRequired']?> <?php echo $row['OverallScore']?> </content>
  • 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.