Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. http://dk2.php.net/manual/en/language.variables.variable.php As for the question, you don't need to use strip_tags when inserting into a database, and I would be wary about creating variables dynamically like that. You risk overriding other variables, which is why register globals is discouraged and deprecated.
  2. How do you know that when even the PHP group doesn't?
  3. Uh... use an XML parser to parse XML. Look up what "XML namespaces" is.
  4. You just need to make sure it's not parsed to a clickable link. You can put it in [nobbc] or tags to prevent that. Example: http://www.google.com
  5. http://en.wikipedia.org/wiki/Nested_set_model
  6. Yeah, that's why I wanted the URL to his website.
  7. You just need to echo the $res1 variable.
  8. Though untested, this should do it in Θ(n): $res = array(); for ($i = 0, $size = 0, $max = count($lines); $size <= 5000; ++$i) { for ($j = $i; $j < $max; $j += 50) { $res[] = $lines[$j]; ++$size; } }
  9. I still like Notepad though I have always found it to bad Notepad didn't support syntax highlighting, intellisense, and auto-indentiation. How about such a simple thing as being able to figure out that LF is a line break? It's the only editor I've ever known that doesn't support LF style line breaks.
  10. I'm slightly impressed with how you're as familiar with oni-kun's history here because 1) you're a fairly new member, 2) oni-kun's account history (warnings, bans, etc.) isn't public. oni-kun is constantly trolling. A while ago he was banned. He started whining and his ban was lifted after a month. Soon after he started again and was given a final warning. He still continued and yesterday happened to be the day when he was banned. So no, he was not just banned for this topic. Besides, like it or not, "free speech" doesn't apply here. Free speech only prevents your government from passing censorship laws. If you visit someone and keep acting like a douche, they can tell you to leave their house/apartment. If you visit someone's website and keep acting like a douche, they can tell you to leave the website. In both cases they can force you to do it as well.
  11. Furthermore, strip_tags will have no effect after htmlentities has been used on the string. Not that a MySQL database is vulnerable to anything HTML related though.
  12. How does reading the fucking manual have anything to do with being male or female?
  13. No, it would be pretty fucked up if Comcast tried changing the internet protocol.
  14. Because he got promoted.
  15. "Don't try to argue with idiots. They'll bring you down to their level and beat you with experience." -- Someone whose name I can't be bothered to look up.
  16. Right, as I said, you need to use "Remove Topic" to remove a topic. The "[X] Remove" thing is for removing posts. SMF allows you to remove a topic that way iff it's the only post in the topic. That's how SMF designed it to work for some reason.
  17. Which button are you using when you're trying to delete it from within the thread? The one with the red X or the one on the bottom where "Mark Solved" also is? Use the one on the bottom.
  18. The fact that many people often have difficulty finding one would indicate otherwise.
  19. Are you familiar with the saying "you get what you pay for"?
  20. coder, programmer (n): an organism that can turn caffeine into code. I guess I'm no coder/programmer then
  21. You could read the changelog. http://php.net/changelog
  22. Here is my take on a very simple one: <?php function math_rpn($expr) { $stack = array(); $getOps = function() use (&$stack) { if (count($stack) < 2) { throw new Exception('Invalid expression: not enough elements on stack'); } $op2 = array_pop($stack); $op1 = array_pop($stack); return array($op1, $op2); }; $tok = strtok($expr, ' '); do { switch ($tok) { case '+': array_push($stack, array_sum($getOps())); break; case '-': list($op1, $op2) = $getOps(); array_push($stack, $op1 - $op2); break; case '*': list($op1, $op2) = $getOps(); array_push($stack, $op1 * $op2); break; case '/': list($op1, $op2) = $getOps(); array_push($stack, $op1 / $op2); break; case '^': list($op1, $op2) = $getOps(); array_push($stack, pow($op1, $op2)); break; default: array_push($stack, $tok); break; } } while ($tok = strtok(' ')); if (count($stack) !== 1) { throw new Exception('Invalid expression: end stack doesn\'t have exactly one element.'); } return $stack[0]; } echo math_rpn('1 2 + 5 * 2 /');
×
×
  • 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.