2

I recently discovered that the EE/CI's SLASH constant isn't the same as the "/" character. Or, at least, in my plug-in code, (SLASH == "/") evaluates to FALSE...

They output the same character, though. I'm confused... can anyone explain why this is the case?

1 Answer 1

5

That's because SLASH is actually the encoded form of /. Here's how it's set:

define('SLASH', '/');
3
  • Thanks, that make sense. I guess that means the constant isn't the best for use in regular expressions or [pre-parse] string replacements for templates. Commented Nov 27, 2012 at 19:42
  • Yeah, I'd just ignore it, the EE core code does. Depending on what you're doing the DIRECTORY_SEPARATOR constant might be worth a look.
    – Dom Stubbs
    Commented Nov 27, 2012 at 19:53
  • 1
    AMP and other constants are also HTML-encoded. Always good to keep this in mind, they can be the cause of so many weird issues. Commented Nov 27, 2012 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.