Categories
Github Server

Private Remote Git Repository Debian Wheezy and other stories from Hell

Setting up your Private Remote Git Repository So you need a private remote git repository for collaborative, backup or convenience reasons. You have your local repository setup and now you want another repository in the cloud. Recently, a few moments ago, I started this task and here I am about an hour and a half […]

Categories
PHP 5

using PHP Values as Variable names and to call Functions

This should apply to perl as well: Variable name: $myvar = ‘foo’; ${$myvar} = ‘haswell’; echo $foo RESULT ‘haswell’ Call a function: $type = ‘red’; $myClass->$type(); == $myClass->red(); Taken from: More helpful stuff: ${“variableName”} = 12; {“functionName”}(); $className->{“variableName”}; $className->{“methodName”}(); StaticClass::${“variableName”}; StaticClass::{“methodName”}(); Are there any other Languages that can do this, I know Perl Can… And […]

Categories
PHP

Loop Through an Associative Array PHP

foreach (array_expression as $key => $value) { echo $key; }

Categories
PHP 5

PHP dump a variable to a file

$var_str = var_export($data, true); $var = “$var_str”; file_put_contents(‘/var/some/location/on/server/value.txt’, $var);

Categories
PHP 5

Check if PHP Post Variable is set

Info from Stackoverflow if (isset($_POST[“mail”]) && !empty($_POST[“mail”])) { echo “Yes, mail is set”; }else{ echo “N0, mail is not set”; }