Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
With PHP, you can use one variable to specify another variable's name. So, a variable variable treats the value of another variable as its name. For example:
<?php
     $hello = "Hi!";
     $a = 'hello';
     echo $$a; 
// output "Hi!"
?>
by Guram Azarashvili
3 years ago
0
PHP
PHP official doc
0
<?php

 // Multidimensional array
 $regions = [
     "Kakheti"=> [
          "city_1"=>"Telavi",
          "city_2"=>"Gurjaani",
          "city_3"=>"Kvareli",
          "City_4"=>"Sighnaghi"
      ],
      "ShidaKartli"=> [
          "City_1"=>"Kaspi",
          "City_2"=>"Gori",
          "City_3"=>"Kareli",
          "City_4"=>"Khashuri"
      ],
      
      "Imereti"=> [
          "city_1"=>"Kutaisi",
          "city_2"=>"Zestafoni",
          "city_3"=>"Terjola",
          "City_4"=>"Chiatura"
      ]
  ];
  echo 'Kakheti is the region of Georgia' . '.' .  ' Its largest city is ' . $regions['Kakheti']['city_1'] . "\n";
  echo 'My homeland is ' . $regions['ShidaKartli']['City_1'] . '.' . 'I like also ' . $regions['ShidaKartli']['City_2'] .  "\n";
  echo '2 years ago'.  ',' . ' I visited to Imereti Firstly I  went to ' . $regions['Imereti']['city_1'] . "\n"; 
  echo 'after I went to '. $regions['Imereti']['city_3'] . ' and ' . $regions['Imereti']['city_2'] . "\n";
  
  ?> 
by Mariam Gelkhauri
3 years ago
0
PHP
Array types
Object Oriented PHP Tutorial
0
modulus(%)
The modulus operator, represented by the % sign, returns the remainder of the division of the first operand by the second operand:
<?php
$n1 =15;
$n2 = 9;
$mod = $n1%$n2;
echo $mod;
//output 6
?>
by Guram Azarashvili
3 years ago
0
PHP
Operators
PHP official doc
0
increment-decrement
$x++; // equivalent to $x = $x+1;
$x--; // equivalent to $x = $x-1; 
$x++; // post-increment 
$x--; // post-decrement 
++$x; // pre-increment 
--$x; // pre-decrement
The difference is that the post-increment returns the original value before it changes the variable, while the pre-increment changes the variable first and then returns the value. Example:
$a  = 2; $b = $a++; // $a=3,  $b=2
$a  = 2; $b = ++$a; // $a=3,  $b=3
by Guram Azarashvili
3 years ago
0
PHP
PHP official doc
0
String Functions
<?php

   # String Functions

     // Function strlen() returns the length of the string, example:
      echo strlen ("Nice to meet you!") . "\n"; /* output - 17 */

     // Function strrev() returns the Reverse of the string, example:
      echo strrev ("Nice to meet you!") . "\n"; /* output - !uoy teem ot eciN */

     // Function strpos() tries to find the second parameter and returns its index. example:
      echo strpos ("Nice to meet you", "you") . "\n"; /* output - 13 */;

     // Function str_replace() replaces the word "Hello" with "Hi" , example:
      echo ("Hello", "Hi", "Hello there") . "\n"; // outputs - Hi there;

     // Function substr() returns the substring between given indexes, example:
      echo substr("Nice to meet you", "5") . "\n"; // outputs - to meet you;
      echo substr("Nice to meet you", 5, 3) . "\n"; // outputs - to meet you;

     // Function trim() removes whitespaces from sides of the string, example:
      echo trim("  Nice to meet you  ") . "\n"; // outputs - Nice to meet you;

     // Function strtoupper() converts the string to upper case, example:
      echo strtoupper("Nice to meet you") . "\n"; //outputs - NICE TO MEET YOU;
    
    // Function strtolower() converts the string to lower case, example:
      echo strtolower("NICE To Meet You") ; //outputs - nice to meet you;
    
    // Function explode() breaks the string by its delimiter, example:
      print_r (explode(" ", "It's the first day of the course!"));
    
    // Function implode() joins the array element based on the delimiter and returns the string, example:
      echo implode(" ", ['Nice', 'to', 'meet', 'you']); //outputs - Nice to meet you;

    // The PHP str_word_count() function counts the number of words in a string, example:
      echo str_word_count("Nice to meet you!"); // outputs - 4
?>
by Mariam Gelkhauri
3 years ago
0
PHP
String Functions
Object Oriented PHP Tutorial
0
Sass code:
$primaryColor: #ec7705;
a {
    color: $primaryColor;
}
After Sass preprocessor:
a {
    color: #ec7705;
}
by Valeri Tandilashvili
5 years ago
0
Sass
variables
Sass Tutorial for Beginners
0
Sass code:
.site-header nav {
    ul {
        padding: 0;
        margin: 0;
    }
    li {
        list-style: none;
        float: left;
    }
}
After Sass preprocessor:
.site-header nav ul {
    padding: 0;
    margin: 0;
}
.site-header nav li {
    list-style: none;
    float: left;
}
by Valeri Tandilashvili
5 years ago
0
Sass
nested CSS
Sass Tutorial for Beginners
0
First
css-minify
package must be installed
globally
npm install css-minify -g
Installing globally is necessary. Before minify command is run,
css-dist
directory must be created, where the output will be saved. The command:
css-minify -f css/d1.css
will minify the specified .css file.
by Valeri Tandilashvili
5 years ago
0
NPM
packages
0
First,
headers
and
expires
modules must be enabled on the server:
sudo a2enmod headers 
sudo a2enmod expires
After that the server must be restarted:
service apache2 restart
Then it will work if
.htaccess
contains the following:
# for enabling browser caching
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
by Valeri Tandilashvili
5 years ago
0
Linux
0
.btn-b extends .btn-a:
.btn-a {
    display: inline-block;
    padding: 10px;
}
.btn-b {
    @extend .btn-a;
    background-color: black;
}
Result in regular CSS:
.btn-a, .btn-b {
    display: inline-block;
    padding: 10px;
}
.btn-b {
    background-color: black;
}
by Valeri Tandilashvili
5 years ago
0
Sass
inheritance
Sass Tutorial for Beginners
0
Results: 1578