“Anexar no PHP” Respostas de código

PHP Appender para arquivar

// LOCK_EX will prevent anyone else writing to the file at the same time
// PHP_EOL will add linebreak after each line
$txt = "data-to-add";
$myfile = file_put_contents('logs.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX);

// Second option is this
$myfile = fopen("logs.txt", "a") or die("Unable to open file!");
$txt = "user id date";
fwrite($myfile, "\n". $txt);
fclose($myfile);
MeVyom

PHP Appender à matriz

$myArr = [1, 2, 3, 4];

array_push($myArr, 5, 8);
print_r($myArr); // [1, 2, 3, 4, 5, 8]

$myArr[] = -1;
print_r($myArr); // [1, 2, 3, 4, 5, 8, -1]
Allen

Array_push no PHP

<?php
// Insert "blue" and "yellow" to the end of an array:


$a=array("red","green");
array_push($a,"blue","yellow");
print_r($a);
?>
MohammadMark

Appender da matriz PHP


<?php
$stack = array("orange", "banana");
array_push($stack, "apple", "raspberry");
print_r($stack);
?>
Homely Hamerkop

Anexar no PHP


append_string($str1, $str2); //

$str1.=$str2; //operator
Splendid Salmon

Respostas semelhantes a “Anexar no PHP”

Perguntas semelhantes a “Anexar no PHP”

Mais respostas relacionadas para “Anexar no PHP” em PHP

Procure respostas de código populares por idioma

Procurar outros idiomas de código