Jump to content

salathe

Staff Alumni
  • Posts

    1,832
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by salathe

  1. Did you try it? What happened? In the PHP script, look at the $argv array. Of course there are other ways. To give one example, you could use popen() and push the data to the PHP script via stdin. This would also allow you to get feedback out of the PHP script (more than just its exit code) by reading its stdout/stderr. But for simplicity, system() will serve you well enough. P.S. Tony, the OP has some C code and wants to call a PHP script from it. Maybe the confusion arose from asking a C question on a PHP forum? Upon reading it as a C question, the original post isn't particularly cryptic at all.
  2. I don't know which datepicker the OP is using, but any worth their salt would have a customisable output-date format. I'm with Jessica, in suggesting looking in that direction. Then you can compare the dates either using PHP's DateTime objects or with plain-old-string-comparison.
  3. Are you just going to /products/search when searching?
  4. Sure it is, see Date Formats and in particular the "American month, day and year" format.
  5. Top hat and tails, or a ball gown.
  6. Before allowing anything like wildcards or "importing" entire namespaces, I'd like to see namespaces implemented more as black boxes (e.g. namespace-scoped variables and such like). Currently they are essentially used as class/function/constant name aliases.
  7. Look into using the available date classes, such as DateTime, DateInterval and DatePeriod. They are designed to make working with dates much less painful than the archaic lets-modify-a-timestamp-in-a-loop approach of yester-year.
  8. So, by "cycle" what is really meant is adjacent occurrences of a sequence of numbers. Now that that's clear, what have you tried so far, if anything?
  9. A cycle! Or is that sequence? I'm confused too!
  10. Go "full PHP", and Python, and Java, and… just take your time.
  11. Then you likely want to get all of the rows, loop over them and access each row's individual collection of cells. The basic idea is something like: $tableRows = $xpath->query('/html/body/table/tbody/tr'); foreach ($tableRows as $row) { $cells = $xpath->query('td', $row); foreach ($cells as $cell) { echo $cell->getNodePath(); echo ' has value '; var_export($cell->nodeValue); echo "<br>\n"; } }
  12. Does she? You suggested an array, not the OP.
  13. You are essentially looking to change the numbers from base 10 to base 62. PHP already has tools available to do this work for you, in the GMP extension. A basic example would look like: echo gmp_strval(gmp_init(12345, 10), 62); // Outputs: 3D7 Note that the above will use a slightly different map of characters than you mentioned in the first post (A-Z comes before a-z). If you want to keep your specified letter order then you could use something like strtr() to convert upper- to lower-case and vice versa. P.S. Your math in the first post is a little off at the boundaries, for example decimal 35 (not 36) should be z.
  14. You appear to be under the impression that URLs dictate the file type of the resource. This simply is not true. There is no reason why http://example.org/foo.exe could not be a completely normal web page (or a animated kitten gif), nor why http://example.org/foo/ could not be the location of an executable. If you still want to "validate" URLs based on whether they appear to contain what might possibly be a direct download link to a file, then sure go ahead but it seems like a silly idea to be. P.S. AyKay47's post isn't a very good example, even if you were to go down that route.
  15. You could add a new placeholder into $sImageTemplate, such as {IMGcount}. Then get the number of items in the $aUnits array using count. $iUnitsCount = count($aUnits); Then replace the placeholder by adding it into the array for strtr. $sImages .= strtr($sImageTemplate, array(..., '{IMGcount}' => $iUnitsCount));
  16. Here are a few resources, perhaps you have already read one or more of them. They should help you get on your way to deciding on a good, and widely supported, font stack. Code Style: CSS font survey and sampler Sitepoint: 8 Definitive Web Font Stacks Smashing Magazine; Guide to CSS Font Stacks: Techniques and Resources CSS Font Stack
  17. * Moved to CSS forum and unlocked *
  18. Except that that would be more forgiving than the OP has stated is allowed thus far.
  19. Apart from never reaching the "is ok" code... not a lot.
  20. I vote for hiding the numbers.
  21. There are .NET implementations of HAML too, if you're already familiar with HAML and .NET (it sounds like you might be) then run with it.
  22. Yes. (Concise Answer)
  23. salathe

    Date

    If you have access to a command line on the server, run locale -a. It could be that the locale is named slightly differently, or you can generate that locale. If you don't have access to check/generate it yourself, I don't see why the host wouldn't be happy to do it for you.
  24. salathe

    Date

    The date function does not change its output based on the locale, for that you want strftime. setlocale(LC_ALL, 'no_NO'); echo strftime('%A %e %B', strtotime('2012-10-29')); // mandag 29 oktober
  25. This is the important point, more so than any performance concerns of the @-operator. The ternary example allows you to define the value when the variable is not set, whereas the @'d variable will give you NULL (so you'll later go check for NULL and assign a value, right).
×
×
  • 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.