Results: 1578
Notes
  • Newest first
  • Oldest first
  • Newest first(All)
  • Oldest first(All)
Secure Copy (scp) Transfer Files
Secure copy, or secure copy protocol/secure copy program (SCP), a command for securely transferring files across UNIX-like systems
scp <file> <username>@<IP address or hostname>:<Destination>
The -r (recursive) option means to copy the whole folder and any sub-folders. You can also copy files the other way:
scp -r <file> OR <Folder> @IP address :<Destination>
scp file.txt remote_username@10.10.0.2:/remote/directory
The scp command syntax take the following form:
scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2
OPTION - scp options such as cipher, ssh configuration, ssh port, limit, recursive copy …etc.
[user@]SRC_HOST:]file1 
- Source file.
[user@]DEST_HOST:]file2 
- Destination file scp provides a number of options that control every aspect of its behavior. The most widely used options are: -
P
- Specifies the remote host ssh port. -
p
- Preserves files modification and access times. -
q
- Use this option if you want to suppress the progress meter and non-error messages. -
C
- This option forces scp to compresses the data as it is sent to the destination machine. -
r
- This option tells scp to copy directories recursively.
by გიორგი ბაკაშვილი
3 years ago
1
Linux
SSH Transfer Files
-1
Start the slice from the third array element, and return the rest of the elements in the array:
<?php
$a=array("red","green","blue","yellow","brown");
print_r(array_slice($a,2));
?>
by გიორგი ბაკაშვილი
3 years ago
1
PHP
Array
PHP official doc
-1
Remove whitespaces from both sides of a string:
$str = " Hello World! ";
echo "Without trim: " . $str;
echo "<br>";
echo "With trim: " . trim($str);
The HTML output of the code above will be (View Source):
<!DOCTYPE html>
<html>
<body>
Without trim:  Hello World! 
With trim: Hello World!
</body>
</html>
The browser output of the code above will be:
Without trim: Hello World!
With trim: Hello World!
by გიორგი ბაკაშვილი
3 years ago
1
PHP
String
PHP official doc
-1
Return "world" from the string:

echo substr("Hello world",6);
Using the start parameter with different positive and negative numbers:
// Positive numbers:
echo substr("Hello world",10)."<br>"; //d
echo substr("Hello world",1)."<br>";  //ello world
echo substr("Hello world",3)."<br>";  //lo world
echo substr("Hello world",7)."<br>"; //orld
echo "<br>";

// Negative numbers:
echo substr("Hello world",-1)."<br>"; //d
echo substr("Hello world",-10)."<br>"; //ello world
echo substr("Hello world",-8)."<br>"; //lo world
echo substr("Hello world",-4)."<br>"; //orld
Using the start and length parameters with different positive and negative numbers:
// Positive numbers:
echo substr("Hello world",0,10)."<br>"; //Hello worl
echo substr("Hello world",1,8)."<br>";  //ello wor
echo substr("Hello world",0,5)."<br>";  //Hello
echo substr("Hello world",6,6)."<br>";  //world
echo "<br>";

// Negative numbers:
echo substr("Hello world",0,-1)."<br>"; //Hello worl
echo substr("Hello world",-10,-2)."<br>"; //ello wor
echo substr("Hello world",0,-6)."<br>";  //Hello
by გიორგი ბაკაშვილი
3 years ago
2
PHP
String
PHP official doc
-1
ციკლი (loops) - ჩვენ შეგვიძლია კოდი გავიმეოროთ ბევრჯერ სხვადასხვა ხაზებზე, მაგრამ ასე საქმეს გავირთულებთ და ჯობია ერთხელ დავწეროთ კოდი და გამოვიყენოთ ციკლი, მივუთითოთ თავად კოდის გამეორება იმდენჯერ, რამდენიც გვსურს, არსებობს სხვადასხვა სახის ციკლები, განვიხილოთ 2 მათგანი. 1. while loop - სანამ პირობა ჭეშმარიტია, მეორდება კოდი. $რიცხვი = 10; //შევქმენით ცვლადი და მივანიჭეთ მნიშვნელობა რიცხვი 10 while ($რიცხვი < 15) { //სანამ ამ ცვლადის მნიშვნელობა ნაკლებია 15-ზე, შესრულდეს კოდი echo "$რიცხვი", "<br>"; //დაბეჭდე ამ ცვლადის მნიშვნელობა $რიცხვი++; } /* აუცილებელია ყოველი შესრულების შემდეგ 1-ით (++) მოვუმატოთ მნიშვნელობას, რომ არ ჩაიციკლოს კოდმა, წინააღმდეგ შემთხვევაში 10 ყოველთვის ნაკლები იქნება 15-ზე და არ შეწყვეტს კოდი შესრულებას */ // დაბეჭდავს 10, 11, 12, 13, 14 - ს 2. for loop - როცა თავად გვსურს განვსაზღვროთ რამდენჯერ გვინდა გაეშვას კოდი for ($x = 0; $x < 5; $x++) { echo "$x", "<br>"; } /* შევქმენით ცვლადი და მივანიჭეთ მნიშვნელობა 0, მივეცით პირობა რომ შესრულდეს კოდი სანამ ამ ცვლადის მნიშვნელობა ნაკლები იქნება 5-ზე, და არ უნდა დაგვავიწყდეს ყოველი ერთი შესრულების მერე მნიშვნელობის თითოჯერ გაზრდა ++-ით, რომ არ ჩაიციკლოს */ // დაბეჭდავს 0, 1, 2, 3, 4 - ს
by Luka Khitaridze
2 years ago
0
PHP
FOR
PHP LOOPS
WHILE
-1
Another example CODE
// Interesting example about if-elseif-else statement

$test = "STRING, NOT INTEGER OR FLOAT";
if ($test < 12) {
	echo "child";
} else if ($test > 12 && $test < 18 ) {
	echo "teen";
} else {
	echo "adult";
}
// what do you think, what will be output, error or ? 
// make that example on your PC if you are a begginer :)
by Luka Khitaridze
2 years ago
1
PHP
PHP LOOPS
-1
For, While Loops CODE
The for loop is used when you know in advance how many times the script should run. Syntax
for (init counter; test counter; increment counter) {
  code to be executed for each iteration;
}

The PHP while Loop

The while loop executes a block of code as long as the specified condition is true.

Syntax
while (condition is true) {
code to be executed;
}
`
by Gigi Butchvelashvili
2 years ago
1
PHP
-1
by დავით ქუთათელაძე
2 years ago
0
PHP
break statement
-1
Results: 1578