{"id":1487,"date":"2017-03-27T22:46:14","date_gmt":"2017-03-27T20:46:14","guid":{"rendered":"https:\/\/vielhuber.de\/?p=1487"},"modified":"2020-02-25T16:51:30","modified_gmt":"2020-02-25T15:51:30","slug":"variablen-in-phpjs-auf-existenz-pruefen","status":"publish","type":"post","link":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/","title":{"rendered":"Variablen in PHP\/JS auf Existenz pr\u00fcfen"},"content":{"rendered":"<p>Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen Funktionen und deren Unterschiede zur \u00dcberpr\u00fcfung zu kennen. \u00c4rgerlicherweise gibt es keine einfache Methode, um im intuitiven\u00a0Sinne zu \u00fcberpr\u00fcfen, ob eine Variable vorhanden ist oder nicht. Was damit gemeint ist, verdeutlicht nachstehende Matrix. Durch kleine Helper-Funktionen l\u00e4sst sich\u00a0das Gew\u00fcnschte aber nachr\u00fcsten.<\/p>\n<p><!--more--><\/p>\n<h3>PHP<\/h3>\n<table class=\"notranslate\">\n<tbody>\n<tr style=\"height: 48.4375px;\">\n<td style=\"width: 92px; height: 48.4375px;\"><strong>\u00a0<\/strong><\/td>\n<td style=\"width: 63px; height: 48.4375px;\"><strong>=== null<\/strong><\/td>\n<td style=\"width: 53px; height: 48.4375px;\"><strong>== null<\/strong><\/td>\n<td style=\"width: 50px; height: 48.4375px;\"><strong>is_null<\/strong><\/td>\n<td style=\"width: 33px; height: 48.4375px;\"><strong>isset<\/strong><\/td>\n<td style=\"width: 45px; height: 48.4375px;\"><strong>empty<\/strong><\/td>\n<td style=\"width: 45px; height: 48.4375px;\"><strong>if\/else<\/strong><\/td>\n<td style=\"width: 52px; height: 48.4375px;\"><strong>ternary<\/strong><\/td>\n<td style=\"width: 68px; height: 48.4375px;\"><strong>count &gt; 0<\/strong><\/td>\n<td style=\"width: 33px; height: 48.4375px;\"><strong>== ''<\/strong><\/td>\n<td style=\"width: 42px; height: 48.4375px;\"><strong>=== ''<\/strong><\/td>\n<td style=\"width: 44px; height: 48.4375px;\"><strong>@__x<\/strong><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>$a<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">true<\/td>\n<td style=\"width: 53px; height: 24px;\">true<\/td>\n<td style=\"width: 50px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 52px; height: 24px;\">false<\/td>\n<td style=\"width: 68px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">false<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>null<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">true<\/td>\n<td style=\"width: 53px; height: 24px;\">true<\/td>\n<td style=\"width: 50px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 52px; height: 24px;\">false<\/td>\n<td style=\"width: 68px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">false<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>[]<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">true<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 52px; height: 24px;\">false<\/td>\n<td style=\"width: 68px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">false<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>0<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">true<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 52px; height: 24px;\">false<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>1<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>-1<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>''<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">true<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 52px; height: 24px;\">false<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 42px; height: 24px;\">true<\/td>\n<td style=\"width: 44px; height: 24px;\">false<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>' '<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">false<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>str<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>[0,1]<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 92px; height: 24px;\"><strong>[0]<\/strong><\/td>\n<td style=\"width: 63px; height: 24px;\">false<\/td>\n<td style=\"width: 53px; height: 24px;\">false<\/td>\n<td style=\"width: 50px; height: 24px;\">false<\/td>\n<td style=\"width: 33px; height: 24px;\">true<\/td>\n<td style=\"width: 45px; height: 24px;\">false<\/td>\n<td style=\"width: 45px; height: 24px;\">true<\/td>\n<td style=\"width: 52px; height: 24px;\">true<\/td>\n<td style=\"width: 68px; height: 24px;\">true<\/td>\n<td style=\"width: 33px; height: 24px;\">false<\/td>\n<td style=\"width: 42px; height: 24px;\">false<\/td>\n<td style=\"width: 44px; height: 24px;\">true<\/td>\n<\/tr>\n<tr style=\"height: 48px;\">\n<td style=\"width: 92px; height: 48px;\"><strong>new stdClass()<\/strong><\/td>\n<td style=\"width: 63px; height: 48px;\">false<\/td>\n<td style=\"width: 53px; height: 48px;\">false<\/td>\n<td style=\"width: 50px; height: 48px;\">false<\/td>\n<td style=\"width: 33px; height: 48px;\">true<\/td>\n<td style=\"width: 45px; height: 48px;\">false<\/td>\n<td style=\"width: 45px; height: 48px;\">true<\/td>\n<td style=\"width: 52px; height: 48px;\">true<\/td>\n<td style=\"width: 68px; height: 48px;\">true<\/td>\n<td style=\"width: 33px; height: 48px;\">false<\/td>\n<td style=\"width: 42px; height: 48px;\">false<\/td>\n<td style=\"width: 44px; height: 48px;\">false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Implementierung von __x:<\/strong><\/p>\n<p class=\"githubgist\" data-gist-file=\"func.php\">740550c6b3d2b9ae03e4d220eb08e6e3<\/p>\n<p>Die Helper-Funktion __x wird dabei mit dem \u00fcblicherweise nicht zu empfehlenden <a href=\"http:\/\/php.net\/manual\/en\/language.operators.errorcontrol.php\" target=\"_blank\" rel=\"noopener noreferrer\">Error Control Operator<\/a>\u00a0@ aufgerufen, um auch zuvor undefinierte Variablen pr\u00fcfen zu k\u00f6nnen.<\/p>\n<h3>JavaScript<\/h3>\n<table class=\"notranslate\">\n<tbody>\n<tr>\n<td><strong>\u00a0<\/strong><\/td>\n<td><strong>=== null<\/strong><\/td>\n<td><strong>== null<\/strong><\/td>\n<td><strong>typeof input === 'undefined'<\/strong><\/td>\n<td><strong>if\/else<\/strong><\/td>\n<td><strong>ternary<\/strong><\/td>\n<td><strong>length &gt; 0<\/strong><\/td>\n<td><strong>== ''<\/strong><\/td>\n<td><strong>=== ''<\/strong><\/td>\n<td><strong>__x<\/strong><\/td>\n<\/tr>\n<tr>\n<td><strong>$a<\/strong><\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>type error<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<\/tr>\n<tr>\n<td><strong>null<\/strong><\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>type error<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<\/tr>\n<tr>\n<td><strong>[]<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<\/tr>\n<tr>\n<td><strong>0<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>1<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>-1<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>''<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<\/tr>\n<tr>\n<td><strong>' '<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<\/tr>\n<tr>\n<td><strong>str<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>[0,1]<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>[0]<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<\/tr>\n<tr>\n<td><strong>new Object()<\/strong><\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>true<\/td>\n<td>true<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<td>false<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Implementierung von __x:<\/strong><\/p>\n<p class=\"githubgist\" data-gist-file=\"func.js\">740550c6b3d2b9ae03e4d220eb08e6e3<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen Funktionen und deren Unterschiede zur \u00dcberpr\u00fcfung zu kennen. \u00c4rgerlicherweise gibt es keine einfache Methode, um im intuitiven\u00a0Sinne zu \u00fcberpr\u00fcfen, ob eine Variable vorhanden ist oder nicht. Was damit [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"gtbabel_prevent_lngs":"","gtbabel_alt_lng":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-1487","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-blog"},"acf":[],"yoast_head":"<title>Variablen in PHP\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David<\/title>\n<meta name=\"description\" content=\"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nat...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Variablen in PHP\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David\" \/>\n<meta property=\"og:description\" content=\"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/\" \/>\n<meta property=\"og:site_name\" content=\"Vielhuber David\" \/>\n<meta property=\"article:published_time\" content=\"2017-03-27T20:46:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-25T15:51:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"552\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"David\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vielhuber\" \/>\n<meta name=\"twitter:site\" content=\"@vielhuber\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"David\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"2\u00a0Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/\"},\"author\":{\"name\":\"David\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"headline\":\"Variablen in PHP\\\/JS auf Existenz pr\u00fcfen\",\"datePublished\":\"2017-03-27T20:46:14+00:00\",\"dateModified\":\"2020-02-25T15:51:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/\"},\"wordCount\":415,\"publisher\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"articleSection\":[\"Blog\"],\"inLanguage\":\"de\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/\",\"name\":\"Variablen in PHP\\\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#website\"},\"datePublished\":\"2017-03-27T20:46:14+00:00\",\"dateModified\":\"2020-02-25T15:51:30+00:00\",\"description\":\"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/variablen-in-phpjs-auf-existenz-pruefen\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vielhuber.de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Variablen in PHP\\\/JS auf Existenz pr\u00fcfen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#website\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/\",\"name\":\"Vielhuber David\",\"description\":\"Full-Stack Developer\",\"publisher\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vielhuber.de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\",\"name\":\"David\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"contentUrl\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"width\":700,\"height\":552,\"caption\":\"David\"},\"logo\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/vielhuber\"]}]}<\/script>","yoast_head_json":{"title":"Variablen in PHP\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David","description":"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nat...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/","og_locale":"de_DE","og_type":"article","og_title":"Variablen in PHP\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David","og_description":"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen","og_url":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/","og_site_name":"Vielhuber David","article_published_time":"2017-03-27T20:46:14+00:00","article_modified_time":"2020-02-25T15:51:30+00:00","og_image":[{"width":700,"height":552,"url":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","type":"image\/jpeg"}],"author":"David","twitter_card":"summary_large_image","twitter_creator":"@vielhuber","twitter_site":"@vielhuber","twitter_misc":{"Verfasst von":"David","Gesch\u00e4tzte Lesezeit":"2\u00a0Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/#article","isPartOf":{"@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/"},"author":{"name":"David","@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"headline":"Variablen in PHP\/JS auf Existenz pr\u00fcfen","datePublished":"2017-03-27T20:46:14+00:00","dateModified":"2020-02-25T15:51:30+00:00","mainEntityOfPage":{"@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/"},"wordCount":415,"publisher":{"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"articleSection":["Blog"],"inLanguage":"de"},{"@type":"WebPage","@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/","url":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/","name":"Variablen in PHP\/JS auf Existenz pr\u00fcfen &#060; Vielhuber David","isPartOf":{"@id":"https:\/\/vielhuber.de\/#website"},"datePublished":"2017-03-27T20:46:14+00:00","dateModified":"2020-02-25T15:51:30+00:00","description":"Bei der t\u00e4glichen Arbeit mit Variablen in PHP und JavaScript st\u00f6\u00dft man oft auf die Abfrage, ob eine Variable leer ist. Dabei lohnt es sich, die nativen","breadcrumb":{"@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vielhuber.de\/blog\/variablen-in-phpjs-auf-existenz-pruefen\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vielhuber.de\/"},{"@type":"ListItem","position":2,"name":"Variablen in PHP\/JS auf Existenz pr\u00fcfen"}]},{"@type":"WebSite","@id":"https:\/\/vielhuber.de\/#website","url":"https:\/\/vielhuber.de\/","name":"Vielhuber David","description":"Full-Stack Developer","publisher":{"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vielhuber.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":["Person","Organization"],"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef","name":"David","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","url":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","contentUrl":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","width":700,"height":552,"caption":"David"},"logo":{"@id":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg"},"sameAs":["https:\/\/x.com\/vielhuber"]}]}},"_links":{"self":[{"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/posts\/1487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/comments?post=1487"}],"version-history":[{"count":11,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/posts\/1487\/revisions"}],"predecessor-version":[{"id":2590,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/posts\/1487\/revisions\/2590"}],"wp:attachment":[{"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/media?parent=1487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/categories?post=1487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vielhuber.de\/da\/wp-json\/wp\/v2\/tags?post=1487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}