Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. As I said earlier, just because you use objects then it doesn't mean it's OOP. OOP is a different way of thinking than other paradigms so you can't just go step by step and make every page an object and every function within that a method of that object. It just doesn't work that way. OOP is about how objects interact with each other whereas for instance procedural programming is about procedures and the state of the application.
  2. I've split this from this topic. Please do not hijack other people's topics with your own problems.
  3. I've never understood those who claim they're "pro-life". You are ending life constantly. The food you eat has all been alive. The water you drink likely contains living organisms that will die due to the acid in your stomach. Sperm cells are also alive so that makes it impossible to reproduce because only one of the many millions of sperm cells will reach the egg which, by the way, is also alive meaning that each time a woman has her period she is taking a live. It's quite simply just not possible to live without ending other life. It's the way of nature... If you think what I said is stupid and that it's not "human life", then guess what? Legally speaking, abortions can only take place when it's not yet legally considered human life... This effectively means that it is not a human you are killing when you perform an abortion. Seeing as prohibition of abortion is a legislative thing then it must conform to the other definitions in the law. I've yet to see a good reason why abortion should not be allowed.
  4. You can also modify the timezone settings here so you can get the times and dates displayed in your local timezone.
  5. Not true. Check out Zend_Json_Decoder (note that it's a noun). It provides an interface for getting JSON strings into arrays thus making JSON support possible for PHP versions below 5.2.0. An analogy is a car factory. You order a car with specific specs and the result of this is a car. You don't care how the car is made, you just want a car. This is the same concept. You provide a JSON string and you get an array back like you expected. How this is parsed is completely irrelevant. The JSON parser is thus a logical object providing a known interface, but an unknown (and irrelevant) implementation. This is one of the design principles in OOP: "Code to an interface and not to an implementation". It would be impossible to encapsulate this in procedural programming and it would thus be more difficult to maintain. Although you might have created a wrapper/main function that will call the individual other functions, there is nothing preventing the people using the API from doing that instead. Your implementation is therefore locked unless you want to upset the developers of the dependent components because you break their stuff. Had you taken an OO approach and encapsulated the process then you would have overcome this problem. You can change the implementation as much as you like as long the the interface remains the same (and it still returns the expected output of course). Now tell me, how is an function more suitable for this task?
  6. Damn CV your posts are huge. [daniel@phpfreaks ~]$ cat > cv_chars.php && php cv_chars.php <?php $db = new PDO('mysql:host=localhost;dbname=', '', ''); $stmt = $db->prepare('SELECT body FROM smf_messages WHERE id_member=22533'); $stmt->execute(); $chars = 0; while ($row = $stmt->fetch()) { $chars += strlen($row['body']); } echo $chars . PHP_EOL; ?> 3196237If we say there are 2,600 characters on one page then you've written a total of 1,229 pages... I guess you have enough material for your quote generator in your sig. Oh yeah, and if anyone bothers, all users have written 202.566 pages (or 526,672,253 chars). </facts> Edit: Inserting missing word.
  7. object: - anything that is visible or tangible and is relatively stable in form - a thing, person, or matter to which thought or action is directed Even in English a person is an object.
  8. Give me an example of a specific thing that cannot logically be an object.
  9. No, you're right, it does not need to be OOP, but neither does it need to be any other programming paradigm. It's entirely possible to create poorly designed application using OOP and it's also possible to create well designed applications using imperative programming. However, saying that it's ridiculous making everything an object in OOP is... ridiculous. In object-oriented programming you make objects. OOP applications generally lead to good maintainability and design when it is actual OOP and not just procedural programming with objects so to speak because OOP is closely tied to OOD. I often see people here who are "using OOP" when they are in fact just emulating namespaces using objects so to speak. That's not OOP and just because you have an object doesn't mean the paradigm is OOP. Also, if making everything an object is ridiculous, does that mean that major languages such as Javascript, Python, and Ruby are ridiculous? Because you know, in those languages everything is an object.
  10. Well, zero comes before one so that means we're in lead
  11. Alright, you can use this team. I use WhatPulse when I'm using Windows. I just think it's interesting to see how much I actually type...
  12. You could store the numbers in an array: form.php <form action="process.php" method="post"> <label for="number">Enter number:</label> <input type="text" name="number" id="number"> <button type="submit">Send</button> </form> process.php <?php session_start(); $number = intval($_POST['number']); // do stuff to number and get $finalNumber if (!isset($_SESSION['finalNumbers'])) { $_SESSION['finalNumbers'] = array(); } $_SESSION['finalNumbers'][] = $finalNumber; echo 'Your final numbers: ' . join(', ', $_SESSION['finalNumber']); echo '<br><a href="form.php">Back to form</a>'; ?> Not tested, by the way.
  13. http://www.phpfreaks.com/tutorial/sessions-and-cookies-adding-state-to-a-stateless-protocol
  14. According to the given definition you are a hacker if you illegally intrude IT systems. This means a hacker likely is a programmer, but not "just" a programmer.
  15. In that case, 1 or 2 are true. 3 may or may not be true. 4 would likely be false if 1 or 2 are true. 5 would likely be true for that group.
  16. That depends on whether you choose the mainstream or the original definition of a hacker.
  17. http://www.phpfreaks.com/forums/index.php/topic,226411.msg1043998.html#msg1043998
  18. I can tell you that the title of the thread is "freelance sysadmin work".
  19. How can you know that your simple website won't evolve into a more complex one later on? That something is simple right now is not an excuse to skip the design phase.
  20. Why not?
  21. Outlook checks every X minutes for new emails. Perhaps that's the issue?
  22. No it won't. I forgot to terminate the process and I just logged in again and checked. ps still shows it as running.
  23. Become a guru or higher and you can see the quote in context where it makes sense
  24. Also, red = admin, blue = mod.
  25. When ever show errors is off, sometimes Apache just spits out a 500 error on fatal parse errors. Weird, eh? But kinda makes sense since it's a parse error. It's not weird. It'll happen if you are running PHP using CGI.
×
×
  • 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.