php lab file

Upload: md-adil

Post on 07-Jul-2018

258 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/19/2019 Php Lab File

    1/23

    AMITY UNIVERSITY

    Lab/ Practical File

    INTRODUCTION TO OPEN SOURCE TECHNOLOGIES(PHP, MS!L"

    S#b$itte% t&' S#b$itte% b'Ms Bhawana Minocha  Md AdilBCA + MCA (iv)

     A1049514004

    INDE

  • 8/19/2019 Php Lab File

    2/23

    S)N&) E*+eri$et- Si.at#re/Re$ar-

    0)Write the PHP script to displa all details o! PHP server "se

     phpin!o()#

    1)

    Write the PHP script to show local$ %lo&al and static scope o! a

    varia&le#

    2)Write the PHP script to reverse a %iven n"'&er and calc"late its s"'#

    3)Write a PHP script to %enerate a list o! !irst 0 pri'e n"'&ers

    4)Write a PHP script to calc"late !actorial o! a %iven n"'&er#

    5)Write a PHP script to %enerate a series o! !irst 0 i&onacci

    n"'&er "sin% rec"rsive !"nction#

    6) Write a PHP script to i'ple'ent atleast seven n"'eric !"nctions

    7)Write a PHP script to i'ple'ent atleast seven strin% !"nctions#

    8)Write a PHP script to co'p"te addition o! two 'atrices#

    09)Write a PHP script to co'p"te '"ltiplication o! two 'atrices#

    00)Write a PHP script to sort the %iven associative arra in

    ascendin% order accordin% to val"e#

    01)Write a PHP script to sort the %iven associative arra in

    descendin% order accordin% to *e

    02)Write a PHP script to show the !"nctionalit o! date and ti'e

    !"nction#

    03)Write a PHP script to i'ple'ent the !"nctionalit o! eplode()

    and i'plode()#

    04)Write a PHP script to i'ple'ent the !"nctionalit o! co'pact()

    and etract()#

    05) Write a PHP script to search an ele'ent "sin% ,inear -earch#

    06)Write a PHP script to i'ple'ent !or' handlin% "sin% %et 'ethod#

    07)a PHP script to i'ple'ent !or' handlin% "sin% post 'ethod#

  • 8/19/2019 Php Lab File

    3/23

    1.  :rite t;e PHP -cri+t t& %i-+la all %etail- &< PHP -er=er #-e +;+i

  • 8/19/2019 Php Lab File

    4/23

    print nlbr("!n!n"".tatic #ariable""!n#alue f & "$);variable();'tatic#ar();'tatic#ar();'tatic#ar();

    print nlbr("!n!nlobal variable&!n""value f a& "$a);

    ?>

  • 8/19/2019 Php Lab File

    5/23

    3. :rite t;e PHP -cri+t t& re=er-e a .i=e #$ber a% calc#late it- -#$)

    8ever'e an, calculate 'u7

    8ever'ing a :u7ber an, 2alculating .u7

    6enter :u7ber& nb'p

  • 8/19/2019 Php Lab File

    6/23

    4. :rite a PHP -cri+t t& .eerate a li-t &<

  • 8/19/2019 Php Lab File

    7/23

    5. Write a PHP script to calculate factorial of a given number.

    Aactorial 2alculator



  • 8/19/2019 Php Lab File

    8/23

    echo "a,a";

    echo "Aactorial of $nu7ber i'& " $C;

    ?>

    6. Write a PHP script to generate a series of first 20 Fibonacci number using recursivefunction

  • 8/19/2019 Php Lab File

    9/23

     

     for ($i=+;$i

  • 8/19/2019 Php Lab File

    10/23

    7. Write a PHP script to implement atleast seven numeric functions.

    :u7eric Aunction'

  • 8/19/2019 Php Lab File

    11/23

    8. Write a PHP script to implement atleast seven string functions.

  • 8/19/2019 Php Lab File

    12/23

     

    Iatri G,,ition

     

    6nter #alue f Iatri *&
     nb'p nb'p nb'p 

  • 8/19/2019 Php Lab File

    13/23

    foreach($.37 a' $value){$7=$value;//printr($7);echo "
    ";

    for($i=+;$i

  • 8/19/2019 Php Lab File

    14/23

    Iatri G,,ition

     

    6nter #alue f Iatri *&
     nb'p nb'p nb'p 

  • 8/19/2019 Php Lab File

    15/23

    foreach($.37 a' $value){$7=$value;//printr($7);echo "
    ";

    for($i=+;$i

  • 8/19/2019 Php Lab File

    16/23

    12. Write a PHP script to sort t!e given associative arra" in descending order according to#e".

  • 8/19/2019 Php Lab File

    17/23

    1$. Write a PHP script to s!o t!e functionalit" of date and time function.

  • 8/19/2019 Php Lab File

    18/23

    echo $,iffF>for7at(D8Da ,a9'); echo "
    ";printr(get,ate()); //for current ,ateecho "
    ";printr(getti7eof,a9()); echo "
    "; //for current ti7e of ,ateprintr(localti7e(ti7e()true));echo "
    "; //local ti7eecho 'trtoti7e("noB") "
    "; //to engli'h for7at

    echo 'trtoti7e("to7orroB") "
    ";$t=ti7e(); //getting current ti7e 7ea'ure, in 'econ,'echo(,ate("F7F,"$t));?>

    1%. Write a PHP script to implement t!e functionalit" of e&plode'( and implode'(.

  • 8/19/2019 Php Lab File

    19/23

    $'t="3he %lue Iagician";print ".tring& "$'t"
    ";

    $a=eplo,e(" "$'t);print("6plo,e Aunction& ");printr($a); echo"

    ";

    print("@7plo,e Aunction& ");printr(i7plo,e($a" "));

     ?>

    15. Write a PHP script to implement t!e functionalit" of compact'( and e&tract'(.

  • 8/19/2019 Php Lab File

    20/23

    1). Write a PHP script to searc! an element using *inear +earc!.

    .earch :a7e&

  • 8/19/2019 Php Lab File

    21/23

    echo "alert(o00 :a7eAoun,)";

    ?>

    17. Write a PHP script to implement form handling using get method.

       

     

  • 8/19/2019 Php Lab File

    22/23

      echo "ou are 6nrolle, in " $63cour'e;

     eit();

      ?> 

    07) :rite a PHP -cri+t t& i$+le$et

    H'erna7e&

    a''Bor,&

  • 8/19/2019 Php Lab File

    23/23

    { echo "alert(Login

    'ucce''full0)