How to make simple syntax hightlighter in PHP

PHP SyntaxhighlighterIn the following article I will show you how you can write your own syntax highlighter with a few lines of PHP. By use of the following PHP snippet you can easily display PHP code on your homepage.
The whole thing is much more easily than you think. Most of the work is done by an internal PHP function named highlight_file. This function reads a file and formats the source code in color. We then merely have to count the lines of the file and output the line numbers, as well as preformat the font.
Since the snippet is not that long, I think the comments in the snippet itself are sufficient. If you still have any questions, just write a comment.

<?php
function highlight_sourcecode($file)
{
//Count the lines of the input file
$amount_of_lines = count(file($file));

//Create a list with all line numbers
$list_linenumbers = range(1, $amount_of_lines);

//Format line […]

How to add DLL to Visual Studio projects

Some days ago I received an email, in which I was asked, how to embed/include .dll-files to into Visual Studio projects. So here comes the answer to the question: How to add dlls to an ongoing Visual Studio project?
The solution to the problem is closer than some of you might think. First you right-click on the “references”-label in the Solution Explorer and click in the context menu on “Add reference” . (Fig. 1)
Now click on the “Browse” button, select the desired (. NET compatible) DLL and confirm your selection by clicking on the “Ok” button. (Fig. 2)
In the last step you can add the appropriate using directives in your source code for an easier access to the methods of the obtaining DLL. (Fig. 3)
Visual Studio - Verweise  Dlls auswählen

Why Whatsapp is boon and bane at the same time

Whatsapp CC LogoWhatsapp, one of the most widely used messengers for mobile devices, should be known to the most people. I myself use Whatsapp since one and a half years and I have always been satisfied. I never had problems with messages send too late or something similar. Even money I had to pay not yet. And as my smartphone phone contract brings an internet flatrate with it, Whatsapp is a free alternative to SMS for me, which I don’t want to miss anymore.
Well now the payment model of whatsapp should indeed be known. iOS users pay once for the app – users of other systems, so as Android, BlackBerry and Windows Phone, get the app for free, but will be prompted after one year to pay for the service. The annual fee is then close to 1$. Even so […]

en.code-bude.net
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.