Jump to content

[PHP] Functii matematice


SkiizO
 Share

Recommended Posts

Cateva functii matematice.

 


  •  
  • abs(nr) - Returneaza valoarea absoluta pozitiva a numarului.
    <?php
    echo abs(6);
    echo abs(-2);
    ?> 


     

  • ceil(nr) - Returneaza valoarea rotunjita a numarului la urmatorul intreg.
    <?php
    echo ceil(7);
    echo ceil(-2.3);
    ?> 


     

  • lcg_value() - Returneaza un numar aleator intre 0 si 1.
    <?php
    echo lcg_value();         // ex: 0.76488835969476
    ?> 


     

  • log(nr, baza) - Returneaza logaritm de numar in baza baza. Daca al doilea parametru nu e specificat, va returna logaritmul natural (in baza e).
    <?php
    echo log(9, 3);         // => 2
    ?> 


     

  • pi() - Returneaza valoarea aproximativa a lui PI.
    <?php
    echo pi();         // 3.1415926535898
    echo M_PI;         // 3.1415926535898
    ?> 


     

 

 

Mai multe exemple pe: Marplo.net

Mai multe informatii pe: PHP.net

Link to comment
Share on other sites

Multumesc. M-au ajutat foarte mult aceste functii !!

Edited by SkiizO Capone
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.