· 9 years ago · Nov 22, 2016, 02:46 PM
1/*mkdir(__DIR__.'index.php/'.$name.'-'.$surname, 0777);
2chmod(__DIR__.'index.php/'.$name.'-'.$surname, 0777);
3
4$myFile = fopen(__DIR__.'/'.$name.'-'.$surname.'/'.$name.".txt", "w") ;
5chmod(__DIR__.'/'.$name.'-'.$surname.'/'.$name.".txt", 0777);
6
7fwrite($myFile, 'My name is '.$name.' '.$surname."I'm ");
8
9fclose($myFile);
10
11$dir= __DIR__.'/'.$name.'-'.$surname ;
12
13move_uploaded_file($_FILES['file']['tmp_name'],$dir.'/'.$_FILES['file']['name']);
14chmod($dir.'/'.$_FILES['file']['name'], 0777);
15*/
16
17$d=(int)($a[1]/$b[0]);
18
19////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
20
21<?php
22$mysqli= mysqli_connect("localhost","root","","anun@ bazai"); //miacnum enq bazain
23mysql_set_charset($mysqli,"utf-8"); //lezvi xndirner chlinen
24
25
26$query = "INSERT INTO tablicaianun@ VALUES ('inchvor mi ban','inchvor mi ban','inchvor mi ban';)"; //avelacnum enq mi nor inchvor mi ban
27$info = mysqli_query($con,$query); //uxarkum enq depi baza
28
29DELETE * FROM test /*tablicaianun@*/ WHERE date<DATE_SUB(CURDATE(),INTERVAL 5 DAY) //jnjuma ajn grarumner@ voronq katarvel en minchev verjin 5 orva @ntacqum
30
31echo mysqli_affected_rows($mysqli); //cujc talis te qani tox bazajum poxvec
32
33$query = "SELECT * FROM tablicaianun@ ;"; //@ntrum enq inch vor mi ban inch vor mi bazaic
34$result = mysqli_query($con,$query); //uxarkum enq reslut-i mej ( masiva )
35
36$countRows = mysqli_num_rows($result); //sjunakneri qanaqkn enq hasvhum
37
38$row = mysqli_fetch_array($result); //tox@ masivi nman mutqagrec $row-i mej
39
40//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
41
42/*
43 $i = array_map(function($item){
44 return strip_tags($item);
45 }, $_POST);
46*/
47'<br>';
48/*
49 define("Const","this is constant");
50 echo constant("Const");
51*/
52'<br>';
53/*
54$trans = array("hello" => "hi", "hi" => "hello");
55echo strtr("hi all, I said hello", $trans);
56*/
57'<br>';
58/*
59$string = "This is an example string";
60$tok = strtok($string, " \n\t");
61while ($tok) {
62 echo "$tok<br />";
63 $tok = strtok(" \n\t");
64}
65*/
66'<br>';
67/*
68$arr1 = $arr2 = array("img12.png", "img10.png", "img2.png", "img1.png");
69echo "Стандартный алгоритм ÑравнениÑ\n";
70usort($arr1, "strcmp"); //sxalna
71print_r($arr1);
72echo "\nÐлгоритм \"еÑтеÑтвенного упорÑдочениÑ\"\n";
73usort($arr2, "strnatcmp");
74print_r($arr2);
75*/
76'<br>';
77/*
78$count = array (1,2,3,4);
79function bazmapatkum($count,$e){
80 foreach ($count as &$value) {
81 $value = $value*$e;
82
83
84 }
85
86 return $count;
87}
88$a=4;
89$newCount=bazmapatkum($count,$a);
90echo'<pre>';
91print_r($newCount);
92echo'</pre>';
93*/
94'<br>';
95/*
96$goals=array(13,14,5,11,4);
97function arrayMaxKey($array) {
98 $max=max($array);
99 $key= array_search($max,$array);
100 return $key;
101}
102$key=arrayMaxKey($goals);
103echo $key;
104*/
105'<br>';
106
107'<br>';
108
109'<br>';
110
111'<br>';
112
113'<br>';
114
115
116//echo "Дата\tИмÑ\tПлатеж"; // = Дата Ð˜Ð¼Ñ ÐŸÐ»Ð°Ñ‚ÐµÐ¶
117//echo strlen('1234567'); // = tveri qanakna hashvum
118//echo strspn("1234 is the answer,", "0123456789"); // = hashvuma tveri qanak@
119//echo str_repeat("Hip",2); // = HipHip
120//echo strrev("dlrow olleH"); // = Hello world
121//echo strstr('MartinElizbaryan@gmail.com', '@'); // = @gmail.com
122//echo strtoupper("hooray!") // = HOORAY
123//echo substr("abcdef", 1); // = "bcdef"
124//echo substr("abcdef", 1, 3); // = "bcd"
125//echo substr("abcdef", -2); // = "ef"
126//echo substr("abcdef", -3, 1); // = "d"
127//echo substr("abcdef", 0, -1); // = "abcde"
128//echo substr("abcdef", 2, -1); // = "cde"
129//echo substr("abcdef", 4, -4); // = ""
130//echo substr("abcdef", -4, -2); // = "cd"
131//echo substr_replace('exo', 'bob', 0) . "<br />\n"; // = exo poxuma bob
132//echo substr_replace('exo', 'bob', 0, 0) . "<br />\n"; // = exo-i dem@ gruma bob
133//echo substr_replace('1234567890', '', 5, -1) . "<br />\n"; // = 5rd hamaric jnjuma minchev naxaverjin hamar
134//echo substr_replace('1234567890', '', 5, 0) . "<br />\n"; // = 5rd hamaric jnjuma minchev verj
135//echo ucfirst('hello world'); // = Hello world
136//echo ucfirst(strtolower('HELLO WORLD')); // = Hello world!
137
138
139
140
141
142###It hasn't been ok
143//ucwords,
144//echo substr_count("This is a test", "is"); //http://www.php.su/functions/?substr-count
145
146
147
148/*$text = "Theeeeeeeeeeeeeeeeeeeeeeeeeeee quick brown fox jumped over the lazy dog.";
149$newtext = wordwrap($text,10, "<br>",10);
150echo "$newtext";*/
151
152
153### CSS Codes
154
155//class text-index:50px; // = mi mat xorqic
156//class text-transform: uppercase,lowercase,capitaliz // = mecatar,poqratar,1-in tarer@ mecatar
157//class text-decoration: overline,line-through,underline, // = Gic bari verevic,mejtexic,takic
158
159
160////////////////////////////////////////////////////////////////////////////////////////////////////////////////
161
162class Car {
163 public $color;
164 public $brand;
165 public $maxSpeed;
166
167public function __construct($color,$brand,$maxSpeed){
168$this->color=$color;
169$this->brand=$brand;
170$this->maxSpeed=$maxSpeed;
171}
172
173public function forCar($distance)
174{
175 $time = $distance / $this->maxSpeed;
176 return $time;
177}
178
179}
180$car1 = new Car('White','BMW',240);
181
182echo $car1->forCar(1000);