Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=310389.0
  2. You should use the option CURLOPT_RETURNTRANSFER to make curl_exec() return the value instead of outputting it directly. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $str = curl_exec($ch);
  3. What does the embed look like? I've used the same code for another project and it worked fine on all browsers.
  4. Something like this should work on all browsers: return window.document.player;
  5. You have a few problems: 1. You're never closing this echo statement: echo "<form action='#' method='post'> 2. You're attempting to do while() { ... } else { ... } which makes no sense and is invalid.
  6. It should be written that way as of now. The [] operator will work for accessing characters of a string before PHP 6, and because it'll be the only non-depreciated way as of PHP 6 it's a good idea to only use [] now. Unless you want your code to break on a server running PHP 6.
  7. You can access the characters of a string by using brackets like that, but it's depreciated as of PHP 6 in favor of the [] operator. $chars = "abc"; echo $chars{2}; // c // But you should do this: echo $chars[2];
  8. Why do something without a reason? It's also bad for SEO.
  9. Alex

    PHP GD

    I don't know about that tutorial specifically, but you can accomplish this using imagecopymerge, and you'll find an example how on that manual page.
  10. Hmmm, I thought the problem started on line 54, col 38. Ah, didn't even see that, nice catch. Must have not had my crystal ball set high enough
  11. Yeah, you might want to check line 72, that seems a bit off.
  12. Yes, you'll always need to do server-side validation.
  13. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=309768.0
  14. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=309766.0
  15. $text =<<<TEXT line containing more than three words less than three words on the previous two lines TEXT; $split = explode("\n", $text); foreach($split as $key => $line) { if(str_word_count($line, 0) < 3) { unset($split[$key]); } } echo implode("\n", $split); str_word_count
  16. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=309516.0
  17. I agree that it's a bad practice and stay away from it completely as well, but it is valid. There are no error_reporting settings in which doing that will cause any errors or warnings.
  18. I beg to differ. It's not my fault the rules were vaguely stated. The program is just a representation for the abstract problem. The output itself isn't important, what it represents is. If I created a suitable solution but made it so it outputs the result using 0s and 1s rather than As and Bs there would be no difference because they both represent the same idea. However, your output doesn't represent the idea, so it is therefore meaningless.
  19. Actually, because constants aren't interpolated into strings like that, leaving out the quotes for associative array indices within double quotes is completely valid.
  20. edit: my solution won't work, I read part of the question wrong.
  21. strrev may produce the correct output, but it doesn't adhere to the rules stated.
  22. That's not fair to say at all. While loops can, and are, used for countless different tasks. The way you loop over a set of data using the while() loop in PHP is but one way it's used. Saying that they're for fetching database information alone really isn't accurate.
×
×
  • 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.