PHP guys - im having a brain fart

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BradM
    Confirmed User
    • Dec 2003
    • 3397

    #1

    PHP guys - im having a brain fart

    I need to rewrite a statement and for some reason I am making it too hard to grasp to myself

    I have:
    Chicken Cheese Waffles
    I want to lower case the letters, remove spaces and replace with -

    What's the easiest way to do this?
  • gooddomains
    Too lazy to set a custom title
    • Jul 2003
    • 10127

    #2
    Here we go:
    echo("chicken-cheese-waffles);

    Comment

    • BradM
      Confirmed User
      • Dec 2003
      • 3397

      #3
      I wasn't specific enough, or maybe you're just being a sarcastic booger.
      This is a string. I want to modify the string.

      Comment

      • Pete-KT
        Workin With The Devil
        • Oct 2004
        • 51532

        #4
        sounds like someone is doing homework

        Comment

        • BradM
          Confirmed User
          • Dec 2003
          • 3397

          #5
          No Pete, I'm not.

          Comment

          • martinsc
            Too lazy to set a custom title
            • Jun 2005
            • 27043

            #6
            Originally posted by gooddomains
            Here we go:
            echo("chicken-cheese-waffles);
            Make Money

            Comment

            • BigBen
              Confirmed User
              • Nov 2004
              • 2299

              #7
              http://php.net/strtolower
              http://php.net/str_replace

              Comment

              • dissipate
                The Dirty Frenchman
                • Nov 2005
                • 8904

                #8
                $string = 'Chicken Cheese Waffles'; // or whatever the hell its stored in
                strtolower($string); // makes it lowercase
                $string = str_replace(" ", "-", $string); // replace spaces with -'s

                Comment

                • CaptainHowdy
                  Too lazy to set a custom title
                  • Dec 2004
                  • 94037

                  #9
                  strtolower function??

                  Comment

                  • BradM
                    Confirmed User
                    • Dec 2003
                    • 3397

                    #10
                    Thanks dissipate that's exactly it. I appreciate it.

                    I knew it was easy. Sheeeeesh.

                    Comment

                    • Kapitan Ivanov II
                      Confirmed User
                      • Jan 2005
                      • 763

                      #11
                      Originally posted by gooddomains
                      Here we go:
                      echo("chicken-cheese-waffles);
                      wrong. should be

                      echo("chicken-cheese-waffles");

                      you left out a parenthysis.
                      Ivanov - The Original Russian Board Guy

                      Comment

                      • CaptainHowdy
                        Too lazy to set a custom title
                        • Dec 2004
                        • 94037

                        #12
                        Originally posted by Kapitan Ivanov II
                        wrong. should be

                        echo("chicken-cheese-waffles");

                        you left out a parenthysis.
                        What if he likes the php error messages??

                        Comment

                        • gooddomains
                          Too lazy to set a custom title
                          • Jul 2003
                          • 10127

                          #13
                          Originally posted by dissipate
                          $string = 'Chicken Cheese Waffles'; // or whatever the hell its stored in
                          strtolower($string); // makes it lowercase
                          $string = str_replace(" ", "-", $string); // replace spaces with -'s
                          correct answer

                          Comment

                          • gooddomains
                            Too lazy to set a custom title
                            • Jul 2003
                            • 10127

                            #14
                            Originally posted by CaptainHowdy
                            What if he likes the php error messages??
                            There must be at least some challenge

                            Comment

                            • Pete-KT
                              Workin With The Devil
                              • Oct 2004
                              • 51532

                              #15
                              homework?

                              Comment

                              • woj
                                <&(©¿©)&>
                                • Jul 2002
                                • 47880

                                #16
                                Originally posted by gooddomains
                                Here we go:
                                echo("chicken-cheese-waffles);
                                Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                                Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                                Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                                Comment

                                Working...