Jump to content

Mcod

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Mcod

  1. Hi there, I am having issues with whitespaces, as I can't get rid of them for some reason. I tried the basics like ltrim or str_replace(" ",""); and so on, but somehow not all whitespaces are removed, no matter what I try. I know there are various things that can cause spacing, so I guess in my case it's not really spaces that are causing the issues, so maybe you have some snippet somewhere which deals with this issue. I'm basically trying to remove every possible whitespaces within a string that are more than one space - even spaces that are caused by something like TAB or similar things - I am sure I am not the first one who ran into this problem, so I am sure someone has a solution for this Your help is greatly appreciated as usual.
  2. Seems like you have an answer to all my questions I will give this a try as soon as possible and report back, but looking at how everything you post works, it will work just fine. Thank you (again)
  3. I am looking for a way to remove session id strings from URL's. As far as I know, they always have the same size and pattern like: http://www.domain.com/forumdisplay.php?s=3d496add17bf8a05551109b5693e9489&f=33 http://www.domain.com/forumdisplay.php?s=3d496add17bf8a05jd7shdbe383e9489&f=21 So my mission is removing the part where it says s=sessionid which is always different. What I try to return would be: http://www.domain.com/forumdisplay.php?&f=33 and http://www.domain.com/forumdisplay.php?f=21 As you can see, I also need to remove the & at the end of the string, so it doesn't say http://www.domain.com/forumdisplay.php?&f=33 as the & would be too much. Now here is another issue... sometimes the session has a different name - for example sessid= or session= which I would also like to cover if possible. Your help is greatly appreciated as usual
  4. Thank you for all your replies - got it working now thanks to you all What a wonderful forum
  5. Hello, I am trying to find out how to remove everything from a string after the third slash. Example: http://domain.com/test.html would become http://domain.com/ one/two/three/four/five/ would become one/two/three/ Your help is greatly appreciated Thank you!
  6. Thank you playful, this did in fact help me a lot
  7. Hi there, I need some help with modifying a string. I always have strings that look like: This is part two - This is part one This is part four - This is part three What I need is to switch the position which is separated by space minus sign space, so it returns: This is part one - This is part two This is part three - This is part four Something like: $string = "this is part two - this is part one"; after the code I am looking for ran, it would return: $newstring = "this is part one - this is part two"; Any ideas how this could be done so it works for everything that is separated by space minus space? Thank you for your time
  8. Thanks for your replies. @adam, The $host part works fine and returns the host, but $port doesn't return anything for some reason (using your edited code). Any idea what might cause the port part to stay empty? Edit, I just noticed that my sql query returned a sample record where no port was existing - sorry about this false statement - the code is fine as posted - Thanks!
  9. I have a database full of strings which are basically URL's with ports, so by default my strings look like: http://example.com:1234/ http://example2.com:3030/ http://example.com:9876/ http://example.com:5432/ What I am looking for is a way to separate the host from the post so the output would be something like: Host: example.com Port: 1234 Note: I once need to check one string at a time, so what I am after is something like: $string = "http://example.com:1234/"; And the result would be something like: $host (would be example.com without http://) $port (would be the port without ending /) Any help would be great Thanks for your time reasing this.
  10. You can be sure that i will Again, thanks a lot - didn't expect an answer that quickly! Just wow
  11. Thank you very much - that did the job more than well
  12. Hello, I am currently having an issue with removing a string from within a string. The strings I deal with are like the examples below: This is - a test - because tests are fun - abc This is - a test because tests are fun - def This is a test - because tests are fun - ghi The good news is that the end is always the same - basically a space, a minus and a space followed by random chars. So technically I would need to remove everything from a string starting at the last space minus space incl the space, minus, space. The result for the examples above would then be: This is - a test - because tests are fun This is - a test because tests are fun This is a test - because tests are fun Would be great if somebody could help me with this (to me) impossible task. Thanks
×
×
  • 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.