PHP – Mobile Detect

Query mobile

What a sweet gem I found! It’s at http://mobiledetect.net/. This will detect or figure out what device the visiting guest is using. Great for responsive design projects, although, Bootstrap can handle that too.

Unity3D Multiplayer Game

Game by James Tadeo

This is an ongoing personal project I work on when I need a bit of fun and sanity. Here’s the link to the test page where the game currently lives. I update it now and again. I also built a custom REST API for the scoreboard and integration with a CMS database.

PHP Classes – How to Create a Class with a Method Function Return

class PHPClassWithMethodAndReturn {

/*Define your variables*/
var $fname;
var $lname;

/*Create our custom function and indicate
it will be accepting two parameters.*/
function ShowInfo($fname,$lname) {

/*Passed parameters need to be assigned
values so we can use them.*/
$this->fname = $fname;
$this->lname = $lname;

/*This is how we will output the value.
will assign the final value to a return variable*/
$ret = "The name of the person is " . $this->fname;
$ret.= "The last name is " . $this->lname;

return $ret;

}

}

//create a class
$myPHPClassWithMethodAndReturn = new PHPClassWithMethodAndReturn;

//Call the method and pass two parameters and output using echo.
echo $myPHPClassWithMethodAndReturn->ShowInfo("James", "Tadeo");
?>

PHP Classes – How to Create a Class with a Method Function


class PHPClassExampleMethod {

/*Define your variables*/
var $fname;
var $lname;

/*Create our custom function and indicate
it will be accepting two parameters.*/
function ShowInfo($fname,$lname) {

/*Passed parameters need to be assigned
values so we can use them.*/
$this->fname = $fname;
$this->lname = $lname;

/*This is how we will output the value.
We concatenate strings and values.*/
echo "The name of the person is " . $this->fname;
echo "Their last name is " . $this->lname;

}

}

//create a class
$myPHPClassWithMethod = new PHPClassExampleMethod;

//Call the method and pass two parameters
$myPHPClassWithMethod->ShowInfo("James", "Tadeo");

?>

PHP Classes – How to Create a Class

// remember to name the file PHPClassExample.php if we plan on using it as part of an includes file.

class PHPClassExample {

/*Define you variables and do an immediate value assignment*/
var $fname = "James";
var $lname = "Tadeo";

}

// create a class
$myPHPClass = new PHPClassExample;

/*Access the class value for the corresponding value, notice we don't need to add the $ in front of the variable, that's because
we already defined it in the class*/

echo $myPHPClass->fname;
echo $myPHPClass->lname;

?>

PHP – Randomize Image Display

There are times when we need to randomize a value. For example, we want to be able to randomize images that appear on a page. Here’s a simple starting point I’ve used in the past to do this.


// get a random number
$rndNumber = rand(0,3);

// plug value in the switch statement - it'll pull up value and serve it up
switch($rndNumber) {

case 0;
$rndImageToUse = "mypic0.png";
break;

case 1:
$rndImageToUse = "mypic1.png";
break;

case 2:
$rndImageToUse = "mypic2.png";
break;

case 4:
$rndImageToUse = "mypic3.png";
break;

default:
$rndImageToUse = "mypic4.png";
}

// spit out the image value (we'll need to wrap this in an img src tag
echo $rndImageToUse;

?>

Web Design – How to Show Your Server’s php.ini File Info

<?php

echo php();

?>

An unassuming looking script, but it does so much.

Testimonials

"Okay, obviously you're showing off here. NOBODY does turnaround times measured in minutes. = : ) Thanks again."
Jim Walker, James Walker Home Inspections
"THANK YOU JAMES YOU ARE INCREDIBLE! My sincerest thank you I really can't thank you enough..."
Bruno Marsala, HDMedia
"James has been a pleasure to work with. He gets stuff done efficiently, and listens to my every little gripe and comment. He's very good and I highly recommend him. "
Robert Nay, Nay Games LLC