-
Posts
15,265 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
preg_replace Any Number Space Any Number
requinix replied to Failing_Solutions's topic in Regex Help
Not sure what you mean, but $number comes from the matched groups in the search expression - the ones you put ()s around. If you had /([0-9])\s+([0-9])([0-9])/ (which is inefficient but suitable for this example) then $1=the digit before the space, $2=the digit immediately after, and $3=the digit immediately after that. \1, \2, and \3 also work. If you wanted groups of numbers then you'd have to change the expression a little: it only matches individual digits right now. /(\d+)\s+(\d+)\s+(\d+)/ with \d being shorthand for [0-9] and + meaning "at least one of", then $1-3 are the first through third numbers. Then you'd replace it with $1,$2,$3 (or \1,\2,\3) -
preg_replace Any Number Space Any Number
requinix replied to Failing_Solutions's topic in Regex Help
Are you sure it's really a space and not a tab or newline character? -
preg_replace Any Number Space Any Number
requinix replied to Failing_Solutions's topic in Regex Help
That would be fine but you aren't adding back in the two digits that the regex matched. $replacement = '$1,$2'; Or you could use lookarounds but I personally avoid them when possible. -
I should have been more specific: I see a FILEINFO_MIME but not a FILEINFO_MIME_TYPE.
-
preg_match_all() basically is the /g flag. Unfortunately I'm too tired to be able to explain it right so that's the best sentence I've come up with yet. Meanwhile /g and /m have nothing to do with your problem. Global only matters when you're trying to get the matches themselves (you're just testing that one exists) and multiline mode only affects end- and beginning-of-line anchors (you don't use any). What is the exact value of $string?
-
Pass ->buffer() the FILEINFO_MIME_TYPE option.
-
Yes. split() uses regular expressions and a pipe | is a special character ("alternation") in one. Thus you have to escape it with a backslash \ to get a literal "pipe character". explode() does not use regular expressions, which is great because you don't actually need them. Plain strings don't have concepts like "alternation" or "escaping"* so no backslash. * I'm not talking about PHP's deal with singly- and doubly-quoted strings. I mean the characters within them, not their representation in code.
-
I'm not looking for just quote=b. :/ I'm looking for [tt]
-
[a-zA-Z0-9] By itself that means only one. It would work with quote=b. Add a "quantifier" to it - which one depends on what you want to allow.
-
What do you have now? I ask mostly because I don't know what inputs you're starting with.
-
createimagefromjpeg() takes up too much memory???
requinix replied to bausman480's topic in PHP Coding Help
The GD extension has two notable problems: image quality and memory usage. Switching to something else is probably your best option. -
If it actually doesn't work then there's something else wrong. But I think by "doesn't work" you really mean "it does work but I get a warning message". explode("|", $line, 5) explode("_", $ID, 3) explode("|", $line, 5)
-
Convert the times to seconds, do the math, and convert back. Using addition as a better example, 0 * 3600 + 1 * 60 + 8.035 = 68.035 0 * 3600 + 2 * 60 + 3.054 = 123.054 123.054 + 68.035 = 191.089 191.089 / 3600 = 0 remainder 191.089 191.089 / 60 = 3 remainder 11.089 so 00:01:08,035 + 00:02:03,054 = 00:03:11,089
-
Speaking of, you could put ads in the item description, but odds are that any code you put in there would not be executed. Simple links+images would work. With that in mind, you could generate the ad markup yourself (or via your ad provider) - at worst you could replicate the JavaScript in your PHP (which would be totally possible).
-
Are you trying to order the results in a certain way? What way?
-
It may sound weird, but in the JOIN condition put that the team ID must be that $team_id(). SELECT * FROM users LEFT OUTER JOIN users_teams ON users_teams.user_id = users.id AND users_teams.team_id = $team_id() WHERE users_teams.team_id != $team_id() If that does sound weird then consider changing the WHERE into the functionally equivalent WHERE users_teams.team_id IS NULL Make sense now?
-
Don't put the full content in there - just a snippet. Then people have to go to your website to see everything, and that's where they get the ads. And are you sure it's the most viewed and not the most downloaded? FYI Google Reader's bot includes the number of subscribers in its user agent string.
-
You are: a slash.
-
Eh... Use something like DOMDocument to navigate through the HTML, pulling out the bits you want from it. If you've done DOM stuff with JavaScript before then you'll be right at home doing it with PHP.
-
The manual page I linked you to has a very simple example of how.
-
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
Oh, so the code you posted is bkupdate.php. What's the current version of test.php? -
Execute Function but not make the browser wait for a return
requinix replied to sanchez77's topic in PHP Coding Help
It probably depends on what "the rest of the script" is. -
Are there any errors? Make sure your php.ini has display_errors = on error_reporting = -1
-
Wouldn't it be easier to just use the form as a form? Submit it normally? Otherwise you can go through the document.forms collection to find the value: document.forms[id or name or index].EndReasonCodeType.value