logo

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ
No Result
View All Result
logo
No Result
View All Result
Trang chủ Using The Var_Dump Function In Php

Using The Var_Dump Function In Php

by Admin _ August 31, 2022

Description

The var_dump() function is used khổng lồ display structured information (type and value) about one or more variables.

Bạn đang xem: Using The Var_Dump Function In Php

Version:

(PHP 4 và above)

Syntax:

var_dump(variable1, variabl2, ....variablen)Parameter:


NameDescriptionRequired /Optional Type
variable1variable2---------variablenThe variable being checked RequiredMixed*

*Mixed: mixed indicates that a parameter may accept multiple (but not necessarily all) types.

Return value:

Nothing

Pictorial presentation of PHP var_dump() function

*

Example -1:

";echo var_dump($var_name2)."";echo var_dump($var_name3)."";echo var_dump($var_name4)."";echo var_dump($var_name5)."";echo var_dump($var_name6)."";?> output :

int(678)string(4) "a678"string(3) "678"string(14) "darkedeneurope.com"float(698.99) float(125689.66) View the example in the browser

Example -2 :

Output :

array(4) <0>=> int(99) <1>=> string(10) "darkedeneurope.com" <2>=> float(67899.99) <3>=> array(3) <0>=> string(1) "X" <1>=> string(1) "Y" <2>=> int(1) View the php var_dump() function using array variable in the browser

Redirect the đầu ra of var_dump() function in a string

We have already learned that var_dump() function is used khổng lồ display structured information (type và value) about one or more expressions.The function outputs its result directly khổng lồ the browser. In the following example the output đầu ra of the var_dump() function stored in a variable as a string, therefore we can manipulate the output. Khổng lồ execute the example we have used two php functions ob_start() & ob_get_clean(). Ob_start() function turns output buffering on where as ob_get_clean() function gets current buffer contents and delete current output buffer.

");echo substr($out,0,20);?> đầu ra :

string(27) "Var_dump output in a string" string(27) "Var_dumpView the output đầu ra in the browser

PHP var_dump() vs print_r()

The var_dump() function displays structured information (type và value) about one or more variables.

Xem thêm: Điện Thoại Iphone 6S Plus 16Gb ( A1687 Là Iphone Gì Hay Nhất 2022

The print_r() function displays human-readable information about a variable.

See the following two examples :

output đầu ra :

array(4) <0>=> string(6) "Banana" <1>=> string(5) "Apple" <2>=> string(5) "Mango" <3>=> string(7) "Coconut" Output :

Array ( <0> => Banana <1> => táo apple <2> => Mango <3> => Coconut )Practice here online :

See alsoPHP Function Reference

Previous: unsetNext: var_export



Share this Tutorial / Exercise on : Facebookand Twitter


PHP: Tips of the Day

Converting an integer to a string in PHP

You can use the strval() function lớn convert a number lớn a string.

From a maintenance perspective its obvious what you are trying to bởi vì rather than some of the other more esoteric answers. Of course, it depends on your context.

$var = 5;// Inline variable parsingecho "I"d lượt thích $var waffles"; // = I"d like 5 waffles// String concatenation echo "I"d lượt thích ".$var." waffles"; // I"d like 5 waffles// The two examples above have the same end value...// ... & so vày the two below// Explicit cast $items = (string)$var; // $items === "5";// Function call$items = strval($var); // $items === "5";Ref : https://bit.ly/2WS4c9l

Share Tweet Linkedin Pinterest
Previous Post

Câu hỏi phỏng vấn php nâng cao

Next Post

Sách kỹ thuật lập trình php mysql (tiếng việt)

CÙNG CHUYÊN MỤC

form register php

Form register php

09/04/2021
fantastic blog (cms) in php with source code

Fantastic blog (cms) in php with source code

28/04/2021
validate form php javascript

Validate form php javascript

28/04/2021
http diendanlequydon com viewtopic php style 6

Http diendanlequydon com viewtopic php style 6

28/04/2021
cách cài đặt php 7

Cách cài đặt php 7

24/01/2023
rövid videó

Rövid videó

23/01/2023
installing apache php mysql on ubuntu 18

Installing apache php mysql on ubuntu 18

20/01/2023
tính kế thừa trong oop php

Tính kế thừa trong oop php

20/01/2023

Newsletter

The most important automotive news and events of the day

We won't spam you. Pinky swear.

Chuyên Mục

  • Hỏi Đáp
  • Kiến Thức
  • Sức Khỏe
  • Tử Vi
  • Công Nghệ

News Post

  • Tải game one piece bounty rush apk

About

Chúng tôi tạo ra trang web nhằm mục đích mang lại kiến thức bổ ích cho cộng đồng, các bài viết được sưu tầm từ nhiều nguồn trên internet giúp mang lại kiến thức khách quan dành cho bạn

©2023 darkedeneurope.com - Website WordPress vì mục đích cộng đồng

Liên Hệ - Giới Thiệu - Nội Quy - Bảo Mật

No Result
View All Result
  • Trang chủ
  • Chuyên mục
    • Hỏi Đáp
    • Kiến Thức
    • Sức Khỏe
    • Tử Vi
    • Công Nghệ
  • Lưu trữ
  • Liên hệ

© 2023 darkedeneurope.com - Website WordPress vì mục đích cộng đồng.