Hướng dẫn how do you check if a line is empty in php? - làm thế nào để bạn kiểm tra xem một dòng trống trong php?

Tôi đang sử dụng API để lấy một số giá trị nhiệt độ và vị trí ở định dạng JSON. Tôi đang viết đầu ra bằng một văn bản đơn giản Cachefile.

Tuy nhiên, một trạm nhiệt độ có thể không báo cáo giá trị nhiệt độ và trong trường hợp đó, đầu ra của tôi sẽ là một dòng trống (\ n). Tôi muốn xử lý trường hợp như vậy bằng cách hiển thị "N/A" cho trạm không báo cáo.

Dưới đây là một cachefile điển hình với nhiệt độ và vị trí báo cáo trạm đầu tiên, và trạm thứ hai tắt (báo cáo hai dòng trống):

27.6
Napoli-Posillipo
(an empty line)
(an empty line)

Tôi đã thử với:

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";

Tuy nhiên, tôi tiếp tục nhận được "N/A" cho cả hai trạm, ngay cả khi trạm đầu tiên báo cáo chính xác giá trị nhiệt độ của nó.

N/A ° C (Napoli-Posillipo) | N/A ° C () | N/A ° C (AVG) | 12m21s trước

Tôi đã thử với fgets () thay vì tệp (), nhưng tôi đã gặp lỗi:

Fgets () mong đợi tham số 1 là tài nguyên, chuỗi được đưa ra trong [...] trên dòng 54

Tôi cũng đã thử sử dụng if (trống ($ nhiệt độ [foo])) nhưng nó không hoạt động, vì tất nhiên \ n! = Trống.

Bất kỳ gợi ý? Cảm ơn trước

Làm thế nào kiểm tra mảng trống hoặc không trong PHP?

Sử dụng chức năng đếm: Hàm này đếm tất cả các phần tử trong một mảng. Nếu số lượng phần tử trong mảng bằng 0, thì nó sẽ hiển thị mảng trống. ....Determine whether a variable is empty

Sử dụng hàm sizeof (): Phương pháp này kiểm tra kích thước của mảng. Nếu kích thước của mảng bằng 0 thì mảng trống nếu không thì mảng không trống ..

Làm thế nào để bạn kiểm tra xem một chuỗi không phải là null trong PHP?(mixed $var): bool

Hàm is_null () kiểm tra xem một biến có null hay không. Hàm này trả về true (1) nếu biến là null, nếu không nó sẽ trả về sai/không có gì.

(Php 4, Php 5, Php 7, Php 8)

trống - xác định xem một biến có trống không

Sự mô tảempty() is essentially the concise equivalent to !isset($var) || $var == false.

trống rỗng (hỗn hợp $var): bool

Thông sốtrue if var does not exist or has a value that is empty or equal to zero, aka falsey, see conversion to boolean. Otherwise returns false.

var

Biến cần được kiểm traempty() / isset() comparison.

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>

Không có cảnh báo nào được tạo ra nếu biến không tồn tại. Điều đó có nghĩa là trống () về cơ bản là tương đương ngắn gọn với! ISSET ($ var) || $ var == Sai.empty() on String Offsets

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>

Trả về giá trị

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)

Trả về true Nếu var không tồn tại hoặc có giá trị trống hoặc bằng 0, hay còn gọi là Fisey, xem chuyển đổi sang Boolean. Nếu không thì trả về false.

Ví dụ: Because this is a language construct and not a function, it cannot be called using variable functions, or named arguments.

Ví dụ #1 Một so sánh đơn giản trống () / isset ().:

Ví dụ #2 trống () trên chuỗi offsetsempty() on inaccessible object properties, the __isset() overloading method will be called, if declared.

Ví dụ trên sẽ xuất ra:

  • Ghi chú
  • __isset()
  • Lưu ý: Bởi vì đây là một cấu trúc ngôn ngữ và không phải là một hàm, nó không thể được gọi là sử dụng các hàm biến hoặc các đối số được đặt tên.
  • Ghi chú:
  • Khi sử dụng trống () trên các thuộc tính đối tượng không thể truy cập, phương thức quá tải __isset () sẽ được gọi, nếu được khai báo.
  • Xem thêm
  • ISSET () - Xác định xem một biến được khai báo và khác với NULL

unset () - Und đặt một biến đã cho

Array_Key_Exists () - Kiểm tra xem khóa hoặc chỉ mục đã cho có tồn tại trong mảng

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
0

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
1

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
2

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
3

Count () - Đếm tất cả các phần tử trong một mảng hoặc trong một đối tượng có thể đếm được

strlen () - Nhận độ dài chuỗi

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
4

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
5

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
6

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Các bảng so sánh loại

Nanhe Kumar ¶

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
8

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
9

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

8 năm trước

Janci ¶

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
1

13 năm trước

Steven tại Nevvix Dot Com ¶

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
2

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
3

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
4

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
5

11 năm trước

Thông tin tại Ensostudio Dot Ru ¶

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
6

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
7

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
8

1 năm trước

Markmanning tại Gmail Dot Com ¶

bool(true)
bool(false)
bool(false)
bool(false)
bool(true)
bool(true)
9

$var0

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

3 năm trước

anh em chấm của bạn dot t tại hotmail dot com

$var2

$var3

$var4

$var5

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

7 năm trước

Array_Key_Exists () - Kiểm tra xem khóa hoặc chỉ mục đã cho có tồn tại trong mảng

$var7

$var8

$var9

Count () - Đếm tất cả các phần tử trong một mảng hoặc trong một đối tượng có thể đếm được

5 năm trước

var0

AdityCse tại Gmail Dot Com ¶

5 năm trước

var1

AdityCse tại Gmail Dot Com ¶

Nanhe Kumar ¶

var2

8 năm trước

strlen () - Nhận độ dài chuỗi

var3

var4

var5

var6

Các bảng so sánh loại

anh em chấm của bạn dot t tại hotmail dot com

var7

var8

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

7 năm trước

Martin Dot Aarhof tại Gmail Dot Com ¶

true0

10 năm trước

Nanhe Kumar ¶

true1

true2

true3

true4

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

8 năm trước

Martin Dot Aarhof tại Gmail Dot Com ¶

true6

true7

true8

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

10 năm trước

strlen () - Nhận độ dài chuỗi

var0

var1

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Các bảng so sánh loại

Martin Dot Aarhof tại Gmail Dot Com ¶

var3

var4

var5

var6

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

10 năm trước

Ẩn danh ¶

var8

var9

false0

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

14 năm trước

6 năm trước

false2

false3

false4

false5

false6

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Chrisdmiddleton tại Gmail Dot Com ¶

strlen () - Nhận độ dài chuỗi

false8

false9

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Các bảng so sánh loại

Nanhe Kumar ¶

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
1

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
2

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

8 năm trước

Steven tại Nevvix Dot Com ¶

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
4

11 năm trước

anh em chấm của bạn dot t tại hotmail dot com

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
5

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
6

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
7

$var 0;// Evaluates to true because $var is empty
if (empty($var)) {
    echo 
'$var is either 0, empty, or not set at all';
}
// Evaluates as true because $var is set
if (isset($var)) {
    echo 
'$var is set even though it is empty';
}
?>
8

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

7 năm trước

15 năm trước

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
0

Martin Dot Aarhof tại Gmail Dot Com ¶

17 năm trước

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
1

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
2

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
3

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
4

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
5

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Rodolphe Dot Bodeau tại miễn phí dot fr ¶

11 năm trước

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
7

$expected_array_got_string 'somestring';
var_dump(empty($expected_array_got_string['some_key']));
var_dump(empty($expected_array_got_string[0]));
var_dump(empty($expected_array_got_string['0']));
var_dump(empty($expected_array_got_string[0.5]));
var_dump(empty($expected_array_got_string['0.5']));
var_dump(empty($expected_array_got_string['0 Mostel']));
?>
8

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Qeremy ¶

10 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
00

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
01

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

rkulla2 tại gmail dot com

15 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
03

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
04

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
05

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
06

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
07

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
08

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Lukas ¶

5 tháng trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
10

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
2

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
12

Gazettesdf ¶

4 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
13

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
14

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
15

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

Javier Alfonso ¶

6 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
17

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
18

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
19

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
20

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
21

Xzero tại Elite7hackers Dot Net

5 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
22

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
23

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
7

AdityCse tại Gmail Dot Com ¶

4 năm trước

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
25

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
26

$display = file($cachename);
$temperature[0] = $display[0];
$location[0] = $display[1];
$temperature[1] = $display[2];
$location[1] = $display[3];

$temp_avg = (($temperature[0]+$temperature[1])/2); //average temperature

if($temperature[0] = "\n"){ //if weather station is not reporting data
   $temperature[0] = "N/A";
   $temp_avg = "N/A";
}

if($temperature[1] = "\n"){
   $temperature[1] = "N/A";
   $temp_avg = "N/A";
}


echo "
".$temperature[0]."°C (".$location[0].") | "; echo "".$temperature[1]."°C (".$location[1].") | "; echo "".$temp_avg."°C (avg) | ".$minutes."m".$secondsleft."s ago
";
27

Làm thế nào để bạn kiểm tra xem một chuỗi có trống trong PHP không?

Chúng ta có thể sử dụng hàm trống () để kiểm tra xem chuỗi có trống hay không. Hàm được sử dụng để kiểm tra xem chuỗi có trống hay không. Nó sẽ trả về true nếu chuỗi trống.use empty() function to check whether a string is empty or not. The function is used to check whether the string is empty or not. It will return true if the string is empty.

NULL hay PHP trống?

is_null () hàm trống () trả về true nếu giá trị của một biến đánh giá là sai.Điều này có thể có nghĩa là chuỗi trống, null, số nguyên 0 hoặc một mảng không có phần tử.Mặt khác, is_null () sẽ chỉ trả về true nếu biến có giá trị null.The empty() function returns true if the value of a variable evaluates to false . This could mean the empty string, NULL , the integer 0 , or an array with no elements. On the other hand, is_null() will return true only if the variable has the value NULL .

Làm thế nào kiểm tra mảng trống hoặc không trong PHP?

Sử dụng chức năng đếm: Hàm này đếm tất cả các phần tử trong một mảng.Nếu số lượng phần tử trong mảng bằng 0, thì nó sẽ hiển thị mảng trống.....
Sử dụng hàm sizeof (): Phương pháp này kiểm tra kích thước của mảng.Nếu kích thước của mảng bằng 0 thì mảng trống nếu không thì mảng không trống ..

Làm thế nào để bạn kiểm tra xem một chuỗi không phải là null trong PHP?

Hàm is_null () kiểm tra xem một biến có null hay không.Hàm này trả về true (1) nếu biến là null, nếu không nó sẽ trả về sai/không có gì.is_null() function checks whether a variable is NULL or not. This function returns true (1) if the variable is NULL, otherwise it returns false/nothing.