Posts double dollar
Post
Cancel

double dollar

reference : http://php.net/manual/en/language.variables.variable.php

Fig.1 - At start, we have a plain form with POST method and an element named newpass**.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//test.php
<?php $blockkeys="array('_SERVER','_SESSION','_GET','_POST','_COOKIE','charset','ip','islinux','url','url_info','doc_root','fm_self','path_info');" foreach="" ($_post="" as="" $key=""?> $val) //LOOP through POST variables
    	if (array_search($key,$blockKeys) === false)
    		{
    			echo "{$key} - {$val}.  
";

    			$$key=$val;
    		}

    echo $newpass;

	echo "<form method='post'>";
	echo "<input type='text' name='newpass' placeholder='type a password' required="">  

";
	echo "<button type='submit'>Set Password</button>  
";
	echo "</form>"; 

Fig.2 - When submitted using the $$ (line 10) creates a variable newpass** (aka $key) and set the value submitted (aka $val).</b>

origin - http://www.pipiscrew.com/?p=3460 php-double-dollar

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags