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

Recommended Answers

fun1(null, 123);
Jump to Post

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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.