Sunday, 5 November 2017

Sample Code

IBM Interview Codes

<?php
-------------------------------------------------------------------------------
$value = array("helo","!","dsad","dasd");
$dec = array_pop($value);
$mesage = implode("",$value);
echo $mesage;
-------------------------------------------------------------------------------
echo @"I hvae $string";

-------------------------------------------------------------------------------
class A {
    public function goto(){
        if(isset($this)){
            echo "This is def";
        }else{
            echo "This is not def";
        }
    }
}

$onj = new A;
echo $onj->goto();


-------------------------------------------------------------------------------
$img = imagecreatetruecolor(400,600);
echo imagesx($img);
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
$a = 5; $b=10;
function sum(){
    global $a;
    $b = $a + $b;
    echo $b;
}
echo sum();
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
$valu = 146.05;
echo round($valu);
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
$timstp = strtotime("30th October 2018");
echo idate('t',$timstp);
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
echo date('d F Y l');
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
$val = 124683579;
$format = number_format($val);
echo $format;
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
$a = 56;
$b = 10;
$c= $a %$b;
echo $c;
-------------------------------------------------------------------------------
?>

No comments:

Post a Comment