w3resource

php.js : get_defined_vars() function

get_defined_vars() function

The get_defined_vars() function returns an associative array of currently defined variables.

Version:

1103.1210

Syntax:

get_defined_vars()

Example of php.js get_defined_vars() function

In the following web document get_defined_vars() function returns an array of all currently defined variables.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>php.js : get_defined_vars() function example</title>
<script type="text/javascript" src="../../phpjs/variable/variable.min.js"> </script>
</head>
<body>
<h1 style="color: green">php.js : get_defined_vars() function example</h1>
<h3>Names and values of all currently defined variable names.</h3>
<hr />
<script type="text/javascript">
//This is done to make the following JavaScript code compatible to XHTML. <![CDATA[
print_r(get_defined_vars());
//]]>
</script>
</body>
</html>

Output of the function:

Array  (      [0] => addEventListener      [1] => location      [2] => navigator      [3] => window      [4] => 
var_export [5] => var_dump [6] => utf8_encode [7] => utf8_decode [8] => unserialize [9] =>
strval [10] => settype [11] => serialize [12] => print_r [13] => isset [14] =>
is_unicode [15] => is_string [16] => is_scalar [17] => is_resource [18] => is_real [19] =>
is_object [20] => is_numeric [21] => is_null [22] => is_long [23] => is_integer [24] =>
is_int [25] => is_float [26] => is_double [27] => is_callable [28] => is_buffer [29] =
> is_bool [30] => is_binary [31] => is_array [32] => intval [33] => import_request_variables
[34] => gettype [35] => get_resource_type [36] => get_defined_vars [37] => floatval [38] =
> empty [39] => echo [40] => doubleval [41] => document [42] => netscape [43] =>
XPCSafeJSObjectWrapper [44] => XPCNativeWrapper [45] => Components [46] => sessionStorage [47] =>
globalStorage [48] => getComputedStyle [49] => dispatchEvent [50] => removeEventListener [51] =
> parent [52] => top [53] => dump [54] => getSelection [55] => scrollByLines [56] =>
scrollbars [57] => scrollTo [58] => scrollBy [59] => scrollByPages [60] => sizeToContent [61] => setTimeout [62] => setInterval [63] => clearTimeout [64] => clearInterval [65] =>
setResizable [66] => captureEvents [67] => releaseEvents [68] => routeEvent [69] =>
enableExternalCapture [70] => disableExternalCapture [71] => open [72] => openDialog [73] => frames
[74] => applicationCache [75] => self [76] => screen [77] => history [78] => content
[79] => menubar [80] => toolbar [81] => locationbar [82] => personalbar [83] => statusbar
[84] => directories [85] => crypto [86] => controllers [87] => opener [88] => innerWidth
[89] => innerHeight [90] => outerWidth [91] => outerHeight [92] => screenX [93] => screenY
[94] => mozInnerScreenY [95] => alert [96] => confirm [97] => prompt [98] => focus [99] => blur [100] => back [101] => forward [102] => home [103] => stop [104] => print
[105] => moveTo [106] => moveBy [107] => resizeTo [108] => resizeBy [109] => scroll [110] => close [111] => updateCommands [112] => find [113] => atob [114] => btoa [115] => showModalDialog [116] => postMessage [117] => localStorage [118] => QueryInterface [119] => name
[120] => scrollX [121] => scrollY [122] => closed [123] => status [124] => defaultStatus
[125] => mozInnerScreenX [126] => pageXOffset [127] => pageYOffset [128] => scrollMaxX [129] => scrollMaxY [130] => length [131] => fullScreen )

View example of php.js get_defined_vars() function in browser

Download phpjs.zip

Previous: php.js: floatval() function
Next: php.js : get_resource_type() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/phpjs/variable/get_defined_vars.php