Jump to content

salathe

Staff Alumni
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by salathe

  1. "It" (three colons as an operator) does not exist, nor is it likely that it ever will. Three colons (:::) was one of many ideas put forward for the namespace separator (which is a backwards slash character, e.g. Foo\Bar). Other ideas before the backslash was decided on included (smiley face), ☃ (snowman) and pretty much every character usually printed on a keyboard. More info: http://wiki.php.net/rfc/namespaceseparator The current code base onto which development happens was recently changed, that's right. However much of the code that was removed will likely get re-introduced again in one form or another over time onto this clean slate. Pushing forward to new and improved PHP certainly wasn't canned, if anything we're more likely to get major PHP updates sooner!
  2. Not a typo at all. As Mr Adam said, it's the identical comparison operator.
  3. You can use ctype_xdigit to check for only hex characters and then also check that the string is 32 characters long. if (ctype_xdigit($md5) && strlen($md5) === 32) { // Yay }
  4. PHP class property names cannot contain the hyphen character (-) like that. Ideally you can use an underscore instead though this will obviously change the names in your XML. $xml->adsense_bar = $adsense_bar; $xml->adsense_box = $adsense_box; $xml->adsense_square = $adsense_square; If you really want to use hyphens then you can do (but it isn't advised): $xml->{'adsense-bar'} = $adsense_bar; $xml->{'adsense-box'} = $adsense_box; $xml->{'adsense-square'} = $adsense_square;
  5. You're not referencing the list of albums correctly. To get that right, use $artists_xml->topalbums->album and then change how you access items inside the loop to something like $value->name. So to echo a list of album titles: $albums_array = $artists_xml->topalbums->album; foreach ($albums_array as $album) { $album_title = $album->name; echo $album_title . PHP_EOL; }
  6. gmdate will only ever return dates/times in GMT... you cannot change that. The regular date function will reflect whatever timezone you set (like Europe/London above).
  7. Sure, you can use the COUNT function in a query. See http://dev.mysql.com/doc/refman/5.5/en/counting-rows.html
  8. Use the saveXML method on $dom: i.e. echo $dom->saveXML();
  9. Which version of PHP are you using? If it is PHP 4.2.0 or newer (which I really hope it is!!) then most of your function could be removed. It can just be: function GetBanner($min, $max) { return mt_rand($min, $max); } Now for why you were getting the notice in the first place. Stepping through your code piece-by-piece: $mtime = ((double)microtime()* 100000); $mtime = explode(" ",$mtime); $mtime = doubleval($mtime[1]) + doubleval($mtime[0]); microtime() returns a string like "0.123456 1234567890" (double) converts that to a floating point number, so the above string would become 0.123456 Multiplied by 100,000 that becomes 12345.6 So $mtime is given the value 12345.6 Next we explode 12345.6 by spaces. There are none so we get an array containing one item: array("12345.6") So now you can see there is no second array value (at offset 1) for the next line to use! P.S. Welcome to PHPFreaks P.P.S. Hmpf typo... d'oh
  10. I'd help if I could but... well.. I can't.
  11. I'm going to play devil's advocate and vote for the Unix timestamp, at least that value is constant(ly incrementing) whereas a formatted string like the one in the OP leaves plenty of room for errors: of the timezone variety, and lack of range (YY).
  12. It happens to everyone* -- nooby or otherwise. * Except those who are... liars
  13. Why are you using invalid syntax?
  14. salathe

    hidden level?

    [ot]<oni-kun> Why do you not follow the rules of the forums? Why do you not? [/ot]
  15. You need to have two sides to each comparison, the variable will not carry through to the second comparison (against 23). else if($durationweeks >=12 && $durationweeks <=23)
  16. I might not quite be understanding what you want to get out of this but here's an idea. $array = array('ONE' => 'ONE', 'TWO'); foreach ($array as $key => $value) { if (is_int($key)) { unset($array[$key]); } } // See what is in the array print_r($array);
  17. What will the string contain? The binary image data, a path to a file, something else?
  18. You could loop over get_included_files looking for the most recently updated file.
  19. Hashes are "digests", not "encryption" (Source)
  20. The idea would be to get each of the items by targeting the appropriate td elements then loop over those (with a foreach) to delve inside and get the required information out of them.
  21. Define "slow" in the context of your problem. Also, your code in the first post is looping 9,999,800,001 times which probably is not what you really want to be doing. Could you more precisely describe what you are trying to do?
  22. It will stop after reaching 99999999.
  23. Take a look at the JSON text, and the object, to see if it looks right: var_dump($json, $json_output)
  24. You're almost there, the only problem is your approach to the loop. foreach ($json_output->results as $result) { echo $result->profile_image_url; }
  25. A few (not an exhaustive list) of practical things: Enough RAM for running multiple virtual environments at the same time Plenty of space for multiple OSes (disk images, too), a tonne of HD movies, music and a stack of porn Long battery life (for wandering around all day with it) Comfortable keyboard (it'll get a lot of use) On mine it's Option + 3, and the key combo is so engrained that I try to use the same key positions at work (on a normal, full size Microsoft keyboard with a dedicated # key (shared with ~)).
×
×
  • 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.