• Resolved Glennf

    (@glennf)


    I’m using this plugin to get a value passed in the URL but getting the string in PHP like below but the string length is always 34 instead of the true length of the string data passed. Why is the string length always 34 even after I trim it?

    <?php

    $cn = ‘[display-get-param name=”country”]’;
    echo $cn;
    $cnTrimmed = trim($cn);

    echo strlen($cnTrimmed); // always returns 34

    ?>

    https://wordpress.org/plugins/get-params/

Viewing 1 replies (of 1 total)
  • There is absolutely no reason to use this plugin in this instance, that’s the problem.

    34 is probably the length of the actual input string you use: [display-get-param name=”country”] has 34 characters, and there’s no point at which the plugin would be invoked to translate this to the actual value of the country parameter.

    If you’re coding in PHP, just use PHP. Something like this:

    <?php

    $cn = $_GET[‘country’];
    $cnTrimmed = trim($cn);

    echo strlen($cnTrimmed); // always returns 34

    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Length of Parameter is Always 34’ is closed to new replies.