Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Joe Watkins:
Expanding Horizons
Nov 03, 2016 @ 09:40:49

In his most recent post Joe Watkins talks about a PHP extension he's been working on that wraps the libui library making it easier to use PHP to create cross-platform user interfaces.

Recently I have been working on a new extension. It is a wrapper around libui, which is a cross platform user interface development library, that allows the creation of native look and feel interfaces in the environments it supports.

That's a few hundred lines of PHP 7 code, moulded into an imitation of the snake game we all used to have on our phones. We've seen other user interface extensions before in PHP, there's even a modified PHP runtime that will allow you to write GTK+ applications.

I don't know anyone that ever deployed any of those extensions, and for very good reasons; PHP5 can barely do anything without allocating a bunch of memory, and doing a bunch of other extremely inefficient things, almost everything it does is inefficient. Beyond a basic forms like application, PHP5 is close to useless.

You can see an example of the snake game in action in this YouTube video. He goes on to talk about the low amounts of CPU and RAM the game (and extension) use and that, with the right amount of work, it can achieve around 60 frames per second. He points out that it is still early on in the development cycle for the extension and libui but there's already documentation for those wanting to investigate.

tagged: libui extension example video snake game efficiency

Link: http://blog.krakjoe.ninja/2016/11/expanding-horizons.html

IBM Security Intelligence:
The Webshell Game Continues
Jul 20, 2016 @ 11:50:15

On the IBM Security Intelligence site there's a new article posted talking about webshells. For those not familiar with webshells, they're scripts that can be used to control servers or work as a platform to access other systems put in place by attackers. In this article they introduce some of the basics around webshells and the rise they're seeing in their use.

The IBM X-Force Research team reported an increase in PHP C99 webshell attacks in April 2016. More recently, webshells dubbed b374k made their mark with attacks that the team has been tracking over the past few months.

Although this blog highlights some features of the b374k shell, the main objective is to call your attention to the fact that PHP applications are becoming an increasingly popular choice for attackers aiming to glean your data and deface your website without much hard work. This threat should be pushed to the top of your priority list — primarily because of the power of the tool used for this type of attack, but also because of the startling increase in this attack type this year.

They start off with some of the basics of webshells, more related to the PHP versions: what they are, what kind of functionality they commonly provide and an example of the UI of a shell. They then talk about some of the common delivery methods, potential entry points of these attacks and some of the "indicators of compromise" you can use to detect them. They also include mitigations you can perform to rid yourself of these webshells including adding additional plugins/software and locking down features of PHP itself.

tagged: webshell game introduction example features attack security

Link: https://securityintelligence.com/the-webshell-game-continues/

NetTuts.com:
Refactoring Legacy Code: Part 5 - Game's Testable Methods
May 27, 2014 @ 09:29:33

NetTuts.com continues on with their next part of their refactoring series today in this new post focusing on (unit) testing more of the application. This includes both the code for the tests and the before/after of the refactored code.

Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. In our previous tutorial, we tested our Runner functions. In this lesson, it is time to continue where we left off by testing our Game class. [...] It is much better to start testing it by its short, testable methods. This is what we'll do in this lesson: find and test those methods.

They start with creating a new "Game" object and finding the first testable method in the class. The tutorial works through this and other related methods to build up a set of "Game" tests and eventually doing some refactoring on the tests themselves. With one method down and tested, they move on to finding and creating the tests for the next few testable methods, looking for something "controllable" that makes for easy testing.

tagged: refactor legacy code series part5 unittest game method

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-5-games-testable-methods--cms-21213

SitePoint PHP Blog:
Dart and PHP: A Legacy Animal Guess Game
Dec 10, 2013 @ 11:54:40

The SitePoint PHP Blog has a new tutorial posted today showing an interesting combination of technologies to create a simple Animal Guesssing Game - using Dart as the frontend and PHP as the backend.

Back when I was learning programming on Apple II using BASIC, there was an Animal Guess Game. This game was a very primitive AI game: the computer tries to ask a few YES/NO questions and receives the answer from the user. Based on the answer, it may ask more Y/N questions until it tries to guess the animal. In this tutorial, we will learn how to re-vitalize this program using PHP as backend and Dart as frontend. Of course, a database will be used to store all the questions and guesses of animals.

He walks you through the database setup (including table definitions) and provides some simple PDO-based code to connect and fetch results. Then comes the Dart frontend. He goes through the installation and configuration and how to make a new Polymer application, also including the markup and Dart code to make the backend connection.

tagged: dart animal guess game backend frontend tutorial

Link: http://www.sitepoint.com/dart-php-legacy-animal-guess-game

thePHP.cc:
Software Development Fluxx
Feb 15, 2013 @ 09:06:57

If you've ever played the card game "Fluxx" (or are familiar with the ever changing rules behind software development) you can release to this new article from Sebastian Bergmann. He makes a link between the "Star Fluxx" card game and how OOP and encapsulation help make changing things easier.

Star Fluxx is a science-fiction-themed version of Fluxx, "a card game [that] is different from most other card games, in that the rules and the conditions for winning are altered throughout the game, via cards played by the players." (Wikipedia) When I heard the description of the game on the aforementioned episode of TableTop it reminded me of software development projects. Changing business rules and requirements (rules and the conditions for winning), probably sounds familiar to you, too.

He talks about how the game could be implemented effectively in OOP classes and interfaces - and how this structure would make it easier to make changes. A largely procedural codebase, however, would make the task much more challenging. The analogy breaks down a bit when it gets to the competitive nature of the game and how software development should be collaborative instead, but it's still effective.

tagged: fluxx software development game testing oop encapsulation

Link:

PHPMaster.com:
Array Handling Functions
Oct 11, 2011 @ 08:37:55

On PHPMaster.com today there's a new tutorial introducing you to the array handling features in PHP - sorting, slicing and more.

In my previous article on PHP arrays I suggested a number of things that are tables and therefore can also be expressed as arrays. In this article I’ll use a pack of playing cards to explore some of the built-in array functions most often needed by PHP programmers. To highlight some of the array-handling functions PHP offers, I’ll be using some components of Buraco - a game very popular in my part of the world and quite similar to Rummy.

In the example he represents a deck of cards with an array of values like "A", "03" and "13". This array is then looped to make the full set of 52 cards and shuffled to deal a "hand". Array functions put to use include array_rand, in_array and sort.

tagged: array handling function tutorial example buraco card game

Link:

Josh Holmes' Blog:
Toughest Developer Puzzle Ever
Jun 02, 2010 @ 11:11:36

If you're looking for a challenge to keep you occupied for a while and want to flex those developer skills, check out the Toughesst Developer Puzzle Ever as created by Jeff Blankenburg.

For the second year in a row, my friend and colleague Jeff Blankenburg has created what is quickly proving to live up to it's namesake - the Toughest Developer Puzzle Ever. Some of the puzzles are technical, some are not but all require that you understand the web, development and technology to solve. Even if you don't get in on the fantastic prizes that Jeff has lined up, there's great bragging rights in being able to solve the Toughest Developer Puzzle Ever.

Josh Holmes (whose blog is linked above) was the creator of three of the levels of this difficult puzzle. Give it a try if you're looking for something to really stretch your knowledge!

tagged: developer puzzle tough game

Link:

IBM developerWorks:
30 game scripts you can write in PHP, Part 1: Creating 10 fundamental scripts
Nov 20, 2008 @ 11:13:00

In a new tutorial from the IBM developerWorks site starts off a new series looking at creating some games, from start to finish.

PHP is an easy-to-use, easy-to-learn, widely accessible programming language. It's well suited for developing simple scripts you can use to help you in all kinds of games. Whether you play simple pen-and-paper games by yourself, complex tabletop role-playing games with a group of people, or online games of any kind, this series will have something for you. Each article in this "30 game scripts you can write in PHP" series will cover 10 scripts in 300 words or less (3d10 stands for "roll three 10-sided dice") simple enough for even a beginning developer, but useful enough for a seasoned game player.

The ten scripts they walk you through are things like a die roller, a name generator, a deck builder/shuffler, a poker dealer and a crossword helper.

tagged: game script fundamental tutorial example

Link:

Paul Reinheimer's Blog:
Web Bot Battle - BETA
Aug 01, 2008 @ 11:12:58

Paul Reinheimer has posted about a contest in the making - a turn-based robot battle sort of game where PHP scripts compete against each other.

Just a quick announcement, in an effort to come up with a self scoring contest, I came up with the ridiculously simple concept of robots firing lasers at each other in a fictional arena. Each robot controlled by a different PHP script, and a central arena managing it all. It's basically a turn based game where your robots take turns for you.

You can check out more about the game and its rules over on the Web Bot Battle site. It defines how your bots should act and even has some examples for you to work from.

tagged: webbotbattle beta game script complete battle turnbased

Link:

SourceForge:
ExtJS Poker (Texas Hold'em Poker with ExtJS, CodeIgniter & MySQL)
Jul 16, 2008 @ 12:06:36

Troy McCormick has pointed out a new game he's developing combining the CodeIgniter PHP framework, MySQL and the ExtJS library - ExtJS Poker.

ExtJS Poker is a Texas Hold'em Poker game programmed using PHP (Codeigniter), MySQL, and ExtJS. check out the early screenshots on the SourceForge project page.

ExtJS is a cross-browser Javascript library that helps you build rich internet applications with high-performance widgets, an extensible Component model and licenses to fit your use. CodeIgniter is a PHP framework with a very small footprint created for programmers who need a simple and elegant toolkit to create full-featured web applications.

tagged: codeigniter texasholdem poker game extjs mysql project

Link: