Jump to content

TylerDiaz

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TylerDiaz's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That will always return true if the length is over 60 - thus always executing that code. Nothing makes my day more than quick and clear support. Another lesson learned for the day. I appreciate the inhuman quick reply to my humble simple question.
  2. So I've dealt with IF's before on PHP. But never with math operators. So the code that is not working is the following. $message = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent sapien. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Mauris quam ante, pellentesque vel, euismod eu, tempus vel, risus. Aenean nibh. Phasellus cursus mattis erat. Suspendisse venenatis tempus felis. Vivamus sed augue et elit faucibus mollis. In luctus. Aenean faucibus interdum sem. Donec vitae tortor ut neque fermentum pretium. Nulla sem neque, consectetuer sed, euismod in, elementum non, felis. Praesent scelerisque dignissim sapien. Sed et pede. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas venenatis. Fusce adipiscing tincidunt mauris."; $myid = 1; $gold_message = strip_tags(trim(strlen($message))); echo $gold_message; if ($gold_message < 59){ $this->System->add_gold($myid, 1); } elseif ($gold_message > 60 || $gold_message <= 109){ $this->System->add_gold($myid, 2); } elseif ($gold_message >= 110 || $gold_message <= 199){ $this->System->add_gold($myid, 3); } elseif ($gold_message >= 200 || $gold_message <= 279){ $this->System->add_gold($myid, 4); } elseif ($gold_message >= 280 || $gold_message <= 339){ $this->System->add_gold($myid, 5); } elseif ($gold_message >= 340 || $gold_message <= 414){ $this->System->add_gold($myid, 6); } elseif ($gold_message >= 415 || $gold_message <= 499){ $this->System->add_gold($myid, 7); } elseif ($gold_message >= 500 || $gold_message <= 574){ $this->System->add_gold($myid, ; } elseif ($gold_message >= 575 || $gold_message <= 634){ $this->System->add_gold($myid, 9); } elseif ($gold_message >= 635 || $gold_message <= 709){ $this->System->add_gold($myid, 10); } elseif ($gold_message >= 710 || $gold_message <= 779){ $this->System->add_gold($myid, 11); } elseif ($gold_message >= 780 || $gold_message <= 855){ $this->System->add_gold($myid, 12); } elseif ($gold_message > 855){ $this->System->add_gold($myid, 14); } I have tested the System add gold, so pay not attention to that please. See the problem is, as soon as it sees "$gold_message > 60" and its value IS above 60 characters, it stops there and adds nothing but 2 gold when the message value is far longer than 60 characters. Anyway I can fix it, any alternatives? Thanks in advance.
  3. I appreciate the theory explination. But if its not too much trouble may you please provide some sample code for me to base of and learn? I think I remember asking nicely for some sample code as well.
  4. I was waiting for someone to point this out.
  5. Hmm not a bright awnser. I do know php - and have studied it an awful lot. So yes its insulting to proclaim someone with that statement. I ask questions out of curiosity - And I asked nicely for example code so I can learn and base of this solution along for anyone else with this complication. The theory of php is what complicates me, as I am self taught. Please refrain from stating unknowledged comments next time.
  6. Something even more effective you can try is: $test = "Ice cream"; function spaceclean($data){ preg_replace ("/ /", "&nbsp", $data); } $food = spaceclean($food0); $category = spaceclean($category0); $brand = spaceclean($brand0); Cleans up your code a bit. And provides same effect.
  7. Thanks, updated done. But now how do I store the regex to a stable variable? A variable that I could use across the entire php script.
  8. Respectful reply. You do make a great point that now in day more and more people are becoming specialists in what they do. Me personally - I am a programmer and designer, but more a designer than programmer. "But without programmers there wouldn't be a lot of function on the internet." Hehe, no Facebook, eBay, Amazon, Wikipedia, Twitter, or other social media app's? Pretty scary place to be...
  9. I appreciate the theory explination. But if its not too much trouble may you please provide some sample code for me to base of and learn?
  10. I personally would not classify them as programming, as neither can interact or modify a database. But they should be respected the same if not more than any web programming language.
  11. I took a look at the link providd above, and its not of too much help for a begginer. The method you want can be done in tons of ways but here I provide a simple way using php: $test = "Ice cream"; echo preg_replace ("/ /", "&nbsp", $test); Should output to the source of: Ice Cream
  12. I disagree completely. Personally I have been doing web design for years now. Us designers should not be degraded into such category - And to your example. That mom and someone would just be installing wordpress not designing for it. If anything they would consider them more programmers than designers since they installed it, created the database and manage it. Without HTML you could not be displaying the message you typed. I dare you to look at the web without CSS and last a week. All tools are important. Please do not degrade either of them - Unless you know what you are implying.
  13. Title asks the main question. Its something I have experimented with for hours now and cant seem to nail the coffin. First off here is the working script: <?php $data = "title:Example; of my work"; function fildercode($data) { $data = preg_replace("(title:(.+?)\;)is",'$1', $data); return $data; } echo filtercode($data); ?> Now, see this line? :: $data = preg_replace("(title:(.+?)\;)is",'$1', $data); How do I save that "$1" into a solid variable like: $solid = $1; echo "$solid"; See when I intent to echo or print the regex variable I get an error. So how can I grab the string of "Example" only?
  14. Hmm i seem to be understanding the concept. Think you can provide a bit more indepth of an explination? Do i modify the .htaaccess and add the code there or?
  15. I have googled it and tried finding how it is done, but not much luck. So i come asking fellow php developers. You know how on twitter and a couple of other sites when you register you get a custom directory according to your registered username? How is that acomplished?
×
×
  • 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.