Jump to content

salathe

Staff Alumni
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by salathe

  1. Maybe. Would the following suffice? list($package, $version) = sscanf($string, "%s %s");
  2. You can also do: var lettersOnly = /^[a-z]+$/i.test(subject);
  3. Check the PHP manual for how to use strtotime, that should hopefully clarify why taquitosensei's code does not work as expected: http://php.net/strtotime
  4. DOM (where $doc is a DOMDocument) $doc->documentElement->getAttributeNS($dom->lookupNamespaceURI('xsi'), 'schemaLocation'); SimpleXML (where $doc is a SimpleXMLElement) echo $doc->attributes('xsi', TRUE)->schemaLocation;
  5. Have a human (who is familiar with the language and its particular quirks) do it.
  6. Fine. Just "farts".
  7. Tazerenix is the winner so far. It looks like we've got a good mix of younguns and old farts, and everything inbetween.
  8. Ahh, I totally misread the posts. Anyway, glad you got it sorted.
  9. Use the decodeURIComponent function.
  10. That is essentially just a regex hiding behind a filter flag; albeit a regex with much more use, testing and breaking than anything that might be cooked up form scratch. The only way to make sure an email is valid ("valid" meaning someone will receive and hopefully read messages sent to that address) is to send an email (if it bounces, it's probably not valid) and find a way of checking it was received (ask for a click through to your site, perhaps)... but that's hardly a quick and easy nor ideal solution, and isn't without problems of its own.
  11. Use a backslash: replace(/\+/g, replace5_1) Without the backslash, JavaScript thinks that you are trying to use a quantifier (to match one or more of something, e.g. a+) yet there is nothing to quantify so it throws an error.
  12. Use two backslashes: replace(/\\/g, replace4_1) Without the second backslash (or first, depending how you look at it), JavaScript thinks that you are trying to escape the second forward slash.
  13. Rather than splitting only on space, which is not what you want, how about a more specific (and complicated) splitting procedure? $string = 'How to "make chicken stew" if you have "no stew"'; $split = preg_split('/"([^"]*)"|\s/', $string, NULL, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); print_r($split); That will output : Array ( [0] => How [1] => to [2] => make chicken stew [3] => if [4] => you [5] => have [6] => no stew )
  14. It looks like you want $store[22] = array_reverse($store[22]);
  15. Only for the specific value that you've provided, anything other than that would be guesswork. $value = 'BNM1234CO'; $number = strspn($value, '1234567890'); echo $number; In this case the call to number_format is not needed because you were asking for the number to be formatted with no decimal places, no thousands separator and no decimal separator.... in other words, it will not make a difference. Also note that the above is one of many (many!) ways to get a number from a string and could well turn out to be useless for your needs but that's all I/we can do with people who don't answer questions designed to help yourself.
  16. Children.
  17. Sure, just do as you would normally to display a page with your PHP and save that output to a file, the latter probably makes most sense to be done when you retrieve the text files so the fetch-txt/parse-txt/convert-to-html/save-html process can all be done in one little script. Point your visitors to the saved file rather than the PHP and their requests won't even need the PHP engine at all. The script itself should be pretty straight-forward using pretty much what you already have. The output buffering functions might be useful.
  18. Something so simple, as it is at the moment, shouldn't even be making a blip on the server resources. Reading from and writing to a database would likely use more cpu/ram! If you're really very concerned about that script, then have it generate some static HTML every time it fetches the remove text file and show that static file to your visitors.
  19. Have you tried a plain file_get_conents() call instead?
  20. Variable variables will not work like that, as you've seen. They cannot act upon subelements of an array or, as in this case, on properties of objects. You could use evial, or work out another way of structuring and/or parsing your map.
  21. Generally, loading a text file from a remote source, using cURL or any other method, should not be slowing your server down at all. Are you sure that cURL is the problem?
  22. I can't honestly say I have a good overview of the job market but I would be *very* surprised if the only jobs available, as your recruiting friend says, are .NET-related. Back when I was looking for work, specifically in PHP, there was a tonne of jobs in many sectors: of course .NET was popular (is that a good or bad thing, is there a lot of work, lack of workers, low job-retention?..) but I was able to find plenty of jobs all over the country for PHP, Python, basic web, loads for Java, and so on. I wouldn't base which language(s) to specialise in solely on current job availability! Find one (for now) that particularly interests you and if you do become a "master" in it there will always (unless it's some obscure, esoteric language) be work there. I would also advise against becoming a "master" of one thing to the exclusion of anything else; do keep up with a wide variety (not just programming language syntax, techniques, etc.) of topics.
  23. You can mark the thread as "Solved" if it is (find the green button to the lower-left of the page below the posts) and there is often no reason to reply further. Due to the nature of forums, particularly help forums, it is best to leave things open for continued assistance, further comments on solutions, etc. -- all in the name of learning.
  24. Ahh now that makes sense, you can't just ask PHP to magically figure out where the number is in there: you need to extract it yourself. Depending on the format of the "number", various solutions might be more useful. For example you could simply get rid of all non-dijit characters in the string, or look for only the first sequence of digits, or extract a specific sub-string if they're always at the same position and length, or do something else entire if none of those are suitable to your specific needs.
  25. You can: click "Profile" in the header and then use the sidebar links on that page click your username beside any of your posts (which you've said you don't want to do) use this as a bookmark
×
×
  • 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.