Welcome Guest, Not a member yet? Register   Sign In
how to pass empty string as a parameter value
#5

[eluser]Jelmer[/eluser]
I've solved it in the past by putting a dash or a zero there and then translate it in the function:
Code:
function mail( $a, $b, $c )
{
    foreach( array( 'a', 'b', 'c' ) as $var )
    {
        if ( $$var == '-' )
            $$var = '';
    }
    // rest of the function
}
So using a marker (in this case '-') to represent an empty string and replacing it in the function with an actual empty string.

URI example: http://www.mysite.com/mail/-/some/thing
Results in:
Code:
$a = '';
$b = 'some';
$c = 'thing';


Messages In This Thread
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 09:10 AM
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 11:28 AM
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 03:23 PM
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 03:32 PM
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 03:36 PM
how to pass empty string as a parameter value - by El Forum - 10-12-2010, 08:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB