понедельник, 9 января 2012 г.

PHP 9 janvāris, matemātiskie paplašinājumi

number abs ( mixed $number )  absolūtā vērtība
float acos ( float $arg ) arcosina argumentu
float acosh ( float $arg ) atgriez apgriezto hiperbolisko kosinus
float asin ( float $arg ) atgriež arksinusu
float asinh ( float $arg ) atgriež apgriezto hiperbolisko sinusu
float atan2 ( float $y , float $x ) aprēķina arktangensu ar diviem mainīgiem
float atan ( float $arg ) atdot arktangensu ar vienu argumentu
number bindec ( string $binary_string ) bināro uz decimālo
float ceil ( float $value ) 
float cos ( float $arg ) aprēkina kosinu no argumenta
float cosh ( float $arg ) apreķina hiperbolisko kosinu
string decbin ( int $number ) binara reprezentācija
string dechex ( int $number ) 
string decoct ( int $number ) oktala reprezentācijā
float deg2rad ( float $number ) ...radiāna...
float exp ( float $arg ) aprēķina eksponentu no argumenta
float floor ( float $value ) noapaļo uz leju līdz veselam skaitlim
int rand ( [int $min , int $max ) aprēķina nejaušo skaitli; var saņemt no diapazona ieskaitot min-max
int getrandmax ( void )  maksimala vērtība random
number hexdec ( string $hex_string ) pārvērš decimālā skaitli
float hypot ( float $x , float $y ) aprēķina hipotenuzu no x un y
bool is_finite ( float $val ) vai skaitlis ir legāla galība uz dotas platformas un OS
bool is_infinite ( float $val ) vai ir pozitīva vai negatīva bezgalība
bool is_nan ( float $val ) vai vērtība nav NAN
mixed max ( array $values ) visslielako vērtibu atdot
mixed max ( mixed $value1 , mixed $value2 [, mixed $value3... ] )
mixed min ( array $values ) vissmazāko vērtību
mixed min ( mixed $value1 , mixed $value2 [, mixed $value3... ] )
int mt_rand ( void ) ar atrāko biblioteku, nejaušo skaitļiem
int mt_rand ( int $min , int $max )
int mt_getrandmax ( void ) 
number octdec ( string $octal_string ) no oktālas uz decimālo reprezentāciju
float pi ( void ) 
M_PI konstanta 3.14
float round ( float $val [, int $precision = 0 [, int $mode = PHP_ROUND_HALF_UP ]] ) noapaļo skaitli
mode 
PHP_ROUND_HALF_UP uz augšu 
PHP_ROUND_HALF_DOWN uz leju
PHP_ROUND_HALF_EVEN līdz tuvākajam veselājam skaitlim līdz pārskaitļiem
PHP_ROUND_HALF_ODD līdz neparskaitļiem

float sin ( float $arg ) atdot sinu
float sinh ( float $arg ) hiperboliskais sīns
float sqrt ( float $arg ) argumenta kvadrat sakkni
float tan ( float $arg ) tangens
float tanh ( float $arg ) hiperboliskais tangens

resource gmp_abs ( resource $a ) no resursa a, kas ir gmp skaitlis (tekstuāla reprezentācija), un atgriež tekstuālo reprezentaciju
resource gmp_sqrt ( resource $a ) kvadrataskane no gmp skaitļa
resource gmp_divexact ( resource $n , resource $d ) izdala n ar d, zinot ka d var izdalit ar n)
resource gmp_div_q ( resource $a , resource $b [, int $round = GMP_ROUND_ZERO ] ) dala skaitļus $a ar $b, 
GMP_ROUND_ZERO noapaļo tuvak 0
GMP_ROUND_PLUSINF tuvāk pozitīvai bezgalībai
GMP_ROUND_MINUSINF tuvāk negatīvai bezgalībai

int gmp_intval ( resource $gmpnumber ) pārvērš skaitliska reprezentācija, ja tas ir iespējams
string gmp_strval ( resource $gmpnumber [, int $base = 10 ] ) pārvērš tekstuāla reprezentācija
resource gmp_add ( resource $a , resource $b ) saskaita divus skaitļus
resource gmp_random ([ int $limiter = 20 ] ) apreķina nejaušo skaitli strp 0 un daļas bitiem, reizinot ar $limiter
<?PHP
$rand = gmp_random(120);
echo gmp_strval($rand);
?>
-------------------------
3761481236692166319633351733642508925642158762836408383435740093611820029137158357072467562345209080790221579913356933836196791821484308675528129715770639682009618433061313245310284633054644484358576179223587521840125644704350960602272285453680274034547981971606228224823522859169659821907939127018310311994819796913740916411516978218075030759894183316956901838279479066093937019288766176145457586264274329703575130087659061874468772523245571810212450007191827454191329317605759330542268105023505070003484329806385412203942055665429285333047317561196598910916335717536973203476655546955946021797826140179412817041220983919158548035644647111539028440380455879380775848089452712733438308793643982076567892332000090187420439429932429839664332451317825242300119362720358250303332967717762896652352131776175308535058251901784150020783330042713654147972200236233727619232834890139997245170141602830813493866312014728049507029177898462514812002126200314736704093329792677365608754155339468464771450531217577645944752512706365167835023544972523288440222594842733062491794545271337394071473123580623351651110112327787744033591664987400068826016780385030991413999007
______________________________________

resource gmp_init ( mixed $number [, int $base = 0 ] ) izveido gmp skaitli no skaita
<?PHP
$rand = gmp_random(3);
echo base64_encode(gmp_strval($rand));
?>
-------------------
NzczOTQ3NDc1MjcxMzQ1MjI3NzM3NjE2MDc1MjQ=
______________________________________

paplašīnājumi:
BC Math - skitļi kam nav ierobežojumu;
Stats = statistikas funkcijās
______________________________________

string base64_encode ( string $data ) saturu(binaru un cit) un pārvērš reprezentācijā kas ir droša (dati +33%) 1mb->1.4mb

$str = 'This is an encoded string';
echo base64_encode($str);
------------------
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
_____________________________________

string base64_decode ( string $data [, bool $strict = false ] )  
strict pārbaude tipu vai ir base64 string

array get_headers ( string $url [, int $format = 0 ] ) piprasa url un atgriež masīvu ar informāciju (galvenes informāciju)
print_r(get_headers('http://google.com',0);
print_r(get_headers('http://google.com',1);
---------------------------
Array
(
    [0] => HTTP/1.0 200 OK
    [1] => Date: Mon, 09 Jan 2012 08:17:03 GMT
    [2] => Expires: -1
    [3] => Cache-Control: private, max-age=0
    [4] => Content-Type: text/html; charset=windows-1257
    [5] => Set-Cookie: PREF=ID=8a940a67d1046e93:FF=0:TM=1326097023:LM=1326097023:S=1oMA3ncf_AUiVdFG; expires=Wed, 08-Jan-2014 08:17:03 GMT; path=/; domain=.google.lv
    [6] => Set-Cookie: NID=54=V2dbL8EKHfXf8REiRIiJ0SYyvYmMtMhJijw7r_1DcCUA_QgDDhVwIfJByl3D-7JhWRGwcTB3f2RbSzk32gCdgmeNfiA8ran1zzos-rWidbcoWO5icz8DIbSl-3vg0uPA; expires=Tue, 10-Jul-2012 08:17:03 GMT; path=/; domain=.google.lv; HttpOnly
    [7] => P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
    [8] => Server: gws
    [9] => X-XSS-Protection: 1; mode=block
    [10] => X-Frame-Options: SAMEORIGIN
)

Array
(
    [0] => HTTP/1.0 200 OK
    [Date] => Mon, 09 Jan 2012 08:17:03 GMT
    [Expires] => -1
    [Cache-Control] => private, max-age=0
    [Content-Type] => text/html; charset=windows-1257
    [Set-Cookie] => Array
        (
            [0] => PREF=ID=4fec980887296cc0:FF=0:TM=1326097023:LM=1326097023:S=BbRmyBPRtGPSvRte; expires=Wed, 08-Jan-2014 08:17:03 GMT; path=/; domain=.google.lv
            [1] => NID=54=YHLVe9k14KeKG3d0lt0PfM0pkc1NRbPidDBYXN7iRk5ftJdYoxxqiYsYAB7MjLew8OG3AELLCW3LOmqX41VB_g84RLeHbKHfBeyNEcIFogymWs8Q-d4wY5Y17oLQf4o8; expires=Tue, 10-Jul-2012 08:17:03 GMT; path=/; domain=.google.lv; HttpOnly
        )

    [P3P] => CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
    [Server] => gws
    [X-XSS-Protection] => 1; mode=block
    [X-Frame-Options] => SAMEORIGIN
)
__________________________________________

array get_meta_tags ( string $filename [, bool $use_include_path = false ] ) url vai vieta, visus meta tegus massīva indeksēts ar nosaukumiem;  

string http_build_query ( mixed $query_data [, string $numeric_prefix [, string $arg_separator [, int $enc_type = PHP_QUERY_RFC1738 ]]] ) pieņem massīvu vai objektu, un izveido get pieprasījumu;

mixed parse_url ( string $url [, int $component = -1 ] ) paņem url adresi un atgriež informāciju par šo adresi.

string rawurlencode ( string $str ) atdot tekstuālo reprezentāciju ar pārvērsto tekstu, izņemot ? un t.t.

string rawurldecode ( string $str ) atdot dekodeto stringu;



























Комментариев нет:

Отправить комментарий