<?php
    function fun1($a,$b)
    {
        echo $b;
    }
    @fun1(123);
    //want to store 123 in $b without changing position of any argument......
?>

Recommended Answers

All 4 Replies

fun1(null, 123);
commented: no i want to pass only 1 value and that value should be saved in $b +0
commented: I am fully agree with blocblue... +2

Can you explain why you want or need to do that?

ok try this

function fun1($a=sumnum,$b)
   {
    echo $b;
   }
@fun1(123);

It will create some warning message, but solves your problem.
hope it helps.

<?php
    function fun1($a, $b=null)
    {
        $b = $a;
        echo $b;
    }

    fun1(123);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.