-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
You're right, it is quite simple. So what have you tried and what was the problem you had with it? I bet what you came up with was really close.
-
Where can I donate to phpfreaks?
requinix replied to TapeGun007's topic in PHPFreaks.com Website Feedback
Thanks for the thought, but we don't really take donations - at least not for the time being. However if an individual member (or more than one) has been particularly helpful then they might be willing to accept it. -
If you know that you want a FlashButton then go ahead and use that. But if all you know is you want a $b button then you don't very well want to have to go through the work of deciding which class to use, right? Easier to have some other code do that for you.
-
Then what you're describing is not possible. 1. You didn't mention where you put the var_dump, but assuming it came sometime after the (unnecessary) foreach loop then it shouldn't matter. 2. The crazy indentation suggests you pieced together your post from different pieces of code, rather than from one complete block. 3. You say it executed the default case - how do you know that? Have you put debugging statements (eg, an echo) in each case to see whether it really is executing that way?
-
Did var_dump($cname) show exactly string(4) "CASH"
-
Yeah... we've been back for a while now. It was only for a month or so.
-
ÿ + R, "psr" (if you see a ÿ then you don't have the wingdings font)
-
I think I used 'd' accidentally, but regardless my thought process was that the number of days would be less than the length of a month... but there will be cases where that's not true, even though a handful of conditions have to be met for it. Good catch.
-
Huh. You'd think "Number of days" would be the right one... I guess "total number of days" is the better choice :-\
-
The location of the site code on the server has absolutely no bearing on the domain name. You can put the files anywhere you want so long as you have your virtualhost config set up with the right ServerName and the right DocumentRoot.
-
I'm not really sure what you're trying to do with DatePeriod... Anyway, you can't use date("W") because that has weeks starting on Monday. It's also for the entire year, not just a month. I don't think there's anything built-in to do this already so you'll have to come up with it on your own. 1. Find the last Friday of the previous month 2. Find the last Friday of the current month 3. Pick a starting Friday based on those 4. Calculate the number of days between that Friday and the current date function week_number(DateTime $date) { // previous month's last friday $previous = new DateTime($date->format("Y-m-d") . " last Friday of last month"); // this month's last friday $current = new DateTime($date->format("Y-m-d") . " last Friday of this month"); // pick a starting friday if ($date >= $current) { $start = $current; } else { $start = $previous; } $diff = $start->diff($date); // $diff = $date - $start return floor($diff->d / 7) + 1; }And a quick test: foreach (["01", "02"] as $month) { $start = new DateTime("2017-{$month}-01"); echo $start->format("F Y"), "\n"; echo "Su Mo Tu We Th Fr Sa\n"; echo "--------------------"; if ($start->format("w") > 0) { echo "\n", str_repeat(" ", $start->format("w")); } foreach (new DatePeriod($start, new DateInterval("P1D"), $start->format("t") - 1) as $day) { if ($day->format("w") == 0) { echo "\n"; } echo " ", week_number($day), " "; } echo "\n\n"; } January 2017 Su Mo Tu We Th Fr Sa -------------------- 1 1 1 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 1 1 1 1 1 February 2017 Su Mo Tu We Th Fr Sa -------------------- 1 1 2 2 2 2 2 2 2 3 3 3 3 3 3 3 4 4 4 4 4 4 4 1 1 1 1 1
-
Conventions are just guidelines. Personally I would make "magical" its own site at /var/www/magical.com but fact is it doesn't really matter. You could have spent the last 4.5 hours working on your site instead of trying to decide where to put the files.
-
Then you need to change the configuration to use /vagrant/myproject.com/public/Magical as the document root instead. But can I assume you already thought of that?
-
root@*:~# cat test.txt [quote name="ajoo" post="1543020" timestamp="1487487301"] I have tried them out in the terminal as a modified example :- sudo sed -i, s,www,the,g test.txt. where test.txt has 2 lines of some text containing the word 'the' a couple of times.The command seems to do nothing. There is no change in test.txt. [/quote] Try putting "www" in it instead. root@*:~# sed -i s,www,the,g test.txt root@*:~# cat test.txt [quote name="ajoo" post="1543020" timestamp="1487487301"] I have tried them out in the terminal as a modified example :- sudo sed -i, s,the,the,g test.txt. where test.txt has 2 lines of some text containing the word 'the' a couple of times.The command seems to do nothing. There is no change in test.txt. [/quote] Try putting "the" in it instead. root@*:~#
-
That's right! I'm glad you've suddenly become familiar with the rules. Now how about giving OP a chance to redeem him/herself?
-
I can't even figure out the problem description, and the machine translation wasn't very helpful. I mean, Input data 3 1 2 1 4 11 3 16 The result of 43 employees, 1 something, 2,1,4 hours for the three employees to each solve a problem, 11,3,16 something else, and then somehow the result is 4?
-
What does the "tablet" version of that look like?
-
It's a copy of a GitHub repo that doesn't have any code in it.
-
Are you sure XAMPP isn't running? That error sounds like it's coming from your browser, not XAMPP. One of http://localhost or http://localhost:8080 should work - or at least give you a 404. Otherwise you need to know which port XAMPP is using (assuming it is running at all) and plug that into the latter URL in place of the 8080.
-
If you mean using it for closing connections and stuff that the class needs, yes. You can't tell PHP to destroy an object - just unset variables/let them drop out of scope and rely on PHP to clean up as it goes.