note 127054 added to function.eval

From: Date: Sat, 14 May 2022 10:04:07 +0000
Subject: note 127054 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-218380@lists.php.net to get a copy of this message
eval() is useful for preprocessing css (and js) with php to embed directly into a style tag in the head tag (or script tag at the bottom of body tag) of the HTML of the page. This: a. Prevents Flash of White in Chrome or Firefox (where an external css file arrives briefly too late to render the HTML). b. Allows radical minifying by testing the page source to see if whole blocks of rules or code are even required, such as for tables. c. Allows custom source-content-dependent css rules to be created on the fly. (I use this to create rules for positioned labels over an image that scale with it) d. Allows generation of a hash of the processed css or js for use in the page's CSP header for style-src or script-src to prevent injection attacks. Here eval() is safe because it is not using user-supplied (person or browser) information ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.47 (proxied: 193.119.59.129) ---- Manual Page -- https://php.net/manual/en/function.eval.php Edit -- https://main.php.net/note/edit/127054 Del: integrated -- https://main.php.net/note/delete/127054/integrated Del: useless -- https://main.php.net/note/delete/127054/useless Del: bad code -- https://main.php.net/note/delete/127054/bad+code Del: spam -- https://main.php.net/note/delete/127054/spam Del: non-english -- https://main.php.net/note/delete/127054/non-english Del: in docs -- https://main.php.net/note/delete/127054/in+docs Del: other reasons-- https://main.php.net/note/delete/127054 Reject -- https://main.php.net/note/reject/127054 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#218380) next »