Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. Unless you've been doing funky stuff, the transition should be rather trivial. If you have a valid XHTML 1.0 Strict document, then it should mostly just be the self-closing tag thing. The W3C specifications and the W3C validator should help you with that.
  2. %d will just be replaced by a signed integer. That should be a fairly simple concept and it's consistent over all languages that has a printf-ish function.
  3. Uhm... that print_r() shouldn't have been there... should have been: function countContains($string, $chars) { preg_match_all('#[' . preg_quote($chars, '#') . ']#', $string, $matches); return count($matches[0]); } Sorry.
  4. Hmm... you could probably do this: function countContains($string, $chars) { preg_match_all('#[' . preg_quote($chars, '#') . ']#', $string, $matches); print_r($matches); }
  5. You could purchase a 1-month supporter subscription using your profile: http://www.phpfreaks.com/forums/index.php?action=profile;area=subscriptions That's $10.
  6. What exactly are you trying to do? You can do $string = preg_replace('#\s#', '', $string); to replace all whitespace (tabs and spaces included).
  7. 4 = r-- = read 2 = -w- = write 1 = --x = execute => 7 = 4+2+1 = rwx = read+write+execute 6 = 4+2 = rw- = read+write 5 = 4+1 = r-x = read+execute 3 = 2+1 = -wx = write+execute 0 = --- = no permissions x1x2x3 = owner, group, other -[---][---][---] | | | '----> other | | '---------> group | '--------------> owner '-----------------> other stuff I won't explain here => 664 = rw-rw-r-- = owner/group: read+write; other: read So if file.php has owner daniel and group apache and it has 664 then my my user and the group apache (which your webserver could use) can read and write to and from that file. Everybody else can only read. Each file and directory has an owner and a group, and each running process will have an owner and group. In order to be allowed to perform an operation (i.e. read, write or execute) the process will have to satisfy at least one of owner, group or other permission masks. There is also something called setuid and setgid. Say for instance that foo.sh is owned by root and has has setuid. Whenever this file is executed it'll now be run as root, even if the user running it isn't root. Same thing for setgid only with groups instead. Then there is "sticky bit" which, when set on directories, ensures that only the owner of a file will be able to move or delete that file. Why someone can or cannot write to a file depends on all the above. You can find more information in the man pages or using Google.
  8. I've attached a file containing three functions. For some reason SMF didn't like the unicode symbols, so I couldn't post it here. You can donate your money to PHP Freaks if you wish. [attachment deleted by admin]
  9. As far as I know you can take it at any age, and I don't see it written anywhere. To be absolutely sure it would probably be a good idea to contact Zend's sales department.
  10. http://php.net/manual/en/language.variables.scope.php
  11. It's not perfect though... echo factorise(68168712496431); => 83.353.755.1076.2864.000377144 The three last ones are clearly not prime numbers.
  12. Huh... never noticed that they used references. To be honest, I think that's pretty stupid. I normally do not use MySQLi directly. I don't like it's interface. I prefer to use PDO or a custom wrapper around either MySQLi or PDO. Anyway, ricmetal, could you perhaps elaborate on how it "doesn't work".
  13. Won't work. Just get it from the local cache, which is what I believe the majority of Firefox extensions do to download streamed videos.
  14. 1) You're defining the variables after you're using them. 2) You should not escape strings when using prepared statements. That's taken care of automatically and you'll thus have it double escaped, so to speak.
  15. I think it's too easy. Anyway, you'll have to show up at a test center. The test is a closed book multiple choice test spanning 90 minutes. Some questions have multiple answers, and some do only have a single answer. You won't have to actually write any code yourself. You'll need knowledge in OOP/OOD, security, XML, web services and features, string manipulation, regular expressions, streams and network programming, syntax, and databases. Personally, I do not regard it very highly, but potential employers may have another opinion. However, if you want it, by all means, go for it. If you know your stuff then you should have plenty of time to complete it.
  16. Dude, learn AT LEAST the basic syntax before trying. INSERT INTO foo (bar) VALUES ('It's not working'); Do you think it can distinguish between your ' and its '?
  17. They need to fix their shit though... [attachment deleted by admin]
  18. Hmm... Wow...I'm impressed. Look - [0] <- line break How'd you do that? Okay, here it didn't work...
  19. [0]
  20. Your calculator is broken if it returns a numerical value for a division by zero. It's undefined, so it's an invalid operation. If you think about it, then dividing by zero doesn't make any sense. You do not divide x cakes any times between no people. How many cakes does each person get? That's x/0. It doesn't make any sense. That's of course a non-mathematical way of rationalizing it. A more mathematical way of saying it would be that multiplication and division are inverse operations, i.e. bx=a <=> a/b=x (where a and b are constants and x is a variable). Now, if b=0 then 0*x=a, right? So if a=0, then any x is the solution to the equation, but if a!=0 then there is no solution. Either way we cannot give a definite solution for b=0, thus division by zero is undefined. What exactly does your calculator claim is the result of a division by zero? You cannot just define a value because that would go against certain axioms and thus your math would be incompatible with mainstream mathematics.
  21. You might want to report that as a bug with the SMF team. Though of course my bug reports are usually ignored, so I'm not sure if they even care.
  22. If you read the manual, the trigonometric functions take a radian value as argument.
  23. Because $_POST['plus'] doesn't exist. There is no field called "plus" in the form, but rather a field with the value "plus". There is a difference. Also, = is the assignment operator, and == is the comparison operator. It's covered in the language reference chapter in the manual.
×
×
  • 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.