{"id":3319,"date":"2026-01-22T18:20:46","date_gmt":"2026-01-22T17:20:46","guid":{"rendered":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3319"},"modified":"2026-01-22T18:22:31","modified_gmt":"2026-01-22T17:22:31","slug":"php-set-a-flexible-variable","status":"publish","type":"post","link":"https:\/\/digitalia.culturanuova.net\/blog\/?p=3319","title":{"rendered":"Set a flexible php variable"},"content":{"rendered":"\n<p>If you want php set a default variable value, but only if you yourself (in a particular case) set (before) another value of that variable, you can use a code like this:<\/p>\n\n\n\n<p>$your_variable = $your_variable <strong>??<\/strong> $a_default_value;<\/p>\n\n\n\n<p>That means: if you doesn&#8217;t define another value (with a code like <code>$your_variable = \"some_particular_value\"<\/code> ), the value of <code>$your_variable<\/code> will be $a_default_value. <\/p>\n\n\n\n<p>Otherwise it will be <code>\"some_particular_value\"<\/code> .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want php set a default variable value, but only if you yourself (in a particular case) set (before) another value of that variable, you can use a code like this: $your_variable = $your_variable ?? $a_default_value; That means: if you doesn&#8217;t define another value (with a code like $your_variable = &#8220;some_particular_value&#8221; ), the value &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/digitalia.culturanuova.net\/blog\/?p=3319\" class=\"more-link\">Leggi tutto<span class=\"screen-reader-text\"> &#8220;Set a flexible php variable&#8221;<\/span><\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[751,566],"tags":[984,957],"class_list":["post-3319","post","type-post","status-publish","format-standard","hentry","category-php","category-webmaster","tag-flexible-variable","tag-variable-php"],"_links":{"self":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3319"}],"version-history":[{"count":4,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3319\/revisions"}],"predecessor-version":[{"id":3323,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3319\/revisions\/3323"}],"wp:attachment":[{"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3319"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3319"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalia.culturanuova.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}