-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
well for one thing, you aren't validating any GET or POST vars. At least, not in that script.
-
And actually, even though you got to the finish line, you still don't quite get it on how you got there. || gets evaluated first, not last. Look at your example: A or B || C This gets evaluated as (A or B) || C You may think that it is evaluating last, but it's not. To demonstrate, let's flip the operators: A || B or C What do you think will happen there? This is what will happen: (A) || (B or C) A gets evaluated first, not the (B or C). If A evaluates true, (B or C) does not even get evaluated. So you see, || is getting evaluated first; PHP looks at it, then starts on the left side of it, then goes to the right side of it if it has to.
-
well I'm glad you understand how it works, but fyi there is a flaw in your "opposite" thing... * is not the same operator as ||. A + B * C does the same thing in both math and in php.
-
paypal me $10 and it's gone.
-
...which is exactly what nightslyr said in the first place. I thought he was a bit off, but then I was thinking about it again a bit later and was like well wait a minute, I know regex order of operations work the same as how nightslyr said, so....yeah...
-
|| gets evaluated first, yes, but here's the thing: it starts off as "everything on the left" || "everything on the right" so it looks at that entire "5 or (5/0)" as the "left of the ||" So that whole thing gets evaluated first. Then within that, it evaluates the 5 as true, discarding the division by zero. Since 5 evaluates as true, "Everything on the right of ||" gets discarded, as well.
-
yeah i rethought it. My mistake. I think nightslyr was right in the first place: if (5 or 0 || (5/0)) -> if ((5 or 0) || (5/0)) so (5 or 0) makes true, and therefore (5/0) does not get evaluated. so even when it is: if (5 or (5/0) || 0) -> ((5 or (5/0)) || 0) (5 or (5/0)) that 5 still makes it true, and the (5/0) still doesn't get evaluated.
-
no. nightslyr mostly got it right. php is lazy evaluation. But it first evaluate 0 || (5/0) and since 0 is false, the division by zero never gets evaluated. THEN it evaluates 5 or 0 which in turn evaluates true because 5 evaluates true.
-
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
okay but all you've really shown is that html is not very good at it. Or at least, css is significantly better. -
Your condition is not actually comparing anything, so the only thing being evaluated is the existence of something. The condition will evaluate true by virtue of anything in there evaluating to something more than 0.
-
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
not true: <div>something</div> <div>something</div> There is already markup at work, because they will appear on two separate lines. -
Cakewalk Guitar Tracks Adobe Soundbooth Those are two "professional grade" ones.
-
The easiest thing to do would be to make the user mark it up like any other tag: [*]something that is how most forums do it. p.s. - stop using posix functions (ereg**) they are deprecated and are removed from the php core as of v6. Use the pcre functions (preg**) instead.
-
99% of getting your question answered is about presentation, not the actual problem at hand. Your question isn't very clear, and your formatting sucks. Is that good enough, or do you want to continue to whine about not getting help, and bitch when someone tells you like it is? What kind of response did you really expect from a thread like this? There isn't a single positive answer to a question like that.
-
yes. usually the server you connected to occasionally pings you and you have to look for it and pong them back, or else it assumes you are inactive and disconnects you.
-
User rankings / ratings for Solved topics
.josh replied to gr1zzly's topic in PHPFreaks.com Website Feedback
Ranks are based on quality, not quantity, because we handpick who to promote to the different groups (guru, phpfreak recommended, moderator, admin), based on how long they've been here, how much they've contributed yes, but if they've contributed worthwhile stuff vs. random misc. topic stuff, etc... basically the goal is in order to get promoted, you have to have proven that you aren't just a random hit-and-run person, are willing to contribute, and you actually know wtf you're talking about. We feel the most accurate way to promote someone based on that criteria is to hand-pick them. Any guru+ member can nominate someone else, and any guru+ can cast a yay or nay vote for the nominee. We do have post-based ranks in place, but they have been purposefully made ambiguous to some kind of "knowledge" assertion, so that people do not get the wrong impression. For example, your post based rank is "Irregular", SA's is "Fanatic", Maq's is "Freak!", mine is "Insane!", etc.. -
it's the 130 character or less generation, what do you expect?
-
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
okay... markup standard? markup description? markup rules? markup definitions? markup (all by itself, just like .htm pages)? markup information? -
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
I concede that in the broadest of terms, it can be classified as "a language," although I maintain that it would be better classified as something else, like fenway's suggested "template". But in the context that it is used in 99% of the time, that's where I have issues. The issue being that average Joe does NOT make the distinction between markup language vs. programming language. My compromise is renaming it to htlm instead of html, in the hopes that people can better understand that it is not a programming language. -
[SOLVED] Extracting specific number of words from text
.josh replied to dpacmittal's topic in Regex Help
it matches anything that is not a space shortcut (\S) \S : space, tab, newline So in the end $newString will not have any tabs or newlines. -
[SOLVED] Extracting specific number of words from text
.josh replied to dpacmittal's topic in Regex Help
preg_match_all('~\S+~',$string,$matches); $newString = implode(' ',array_slice($matches[0],0,79)); echo $newString; -
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
To me, language markup and markup language are two different things. Yes, it is "officially" called markup language, but IMO clearly it should have been called language markup. -
it also may match additional characters based on locale settings. For portability, safest bet is to not use shortcut classes.
-
can't people tell the difference between php and html ?
.josh replied to saltedm8's topic in PHPFreaks.com Website Feedback
which is why I don't consider it to be a language, but a system, a "template" (thank you fenway). I maintain that "language" was snuck into the name by marketing. -
[SOLVED] A decent, effective filter: using preg_replace
.josh replied to kratsg's topic in PHP Coding Help
kinda off-topic but here's an example of using the 'e' modifier with preg_replace: $string = "A AA AAA AAAA AAAAA AAAA AAA AA A"; $string = preg_replace("~(\w{3,})~e","strtolower('$1')",$string); echo $string; output: A AA aaa aaaa aaaaa aaaa aaa AA A