PHP Code Snippets

PHP Code Snippets

This post contains a list PHP code snippets. In the code snippets, you can find PHP related topics with a quick explanation and a code example. I made this collection of code snippets so that if I ever forget something I can just come here to refresh my memory. Hopefully, you’ll find it useful too.

Wordpress Plugin Development

How To Make a WordPress Plugin Tutorial

Some time ago I had to make a WordPress plugin as part of my job. Here I will document what I have learned in the process. Hopefully, this can also be useful to anyone who wants to make their own plugin or do any other WordPress development. In this post, we will make a plugin while at the same time learning how to use some of the WordPress APIs.

8-bit computer in an FPGA Arduino controller and programmer

8-Bit Computer Arduino Programmer

This post is about the Arduino programmer I made for the 8-Bit Computer in an FPGA. I will show how to use it, connect it, and briefly explain how it works. If you are interested in the source code you can get it all here on Github. This programmer should also be compatible with a normal breadboard computer like the one Ben Eater made in his video series.

C# Code Snippets String Interpolation

C# String Interpolation

In this tutorial, we will take a look at string interpolation in C#. To enable string interpolation put the $ character before the string. Now variables in brackets can be put straight into a string. This is a bit more convenient compared to splitting up as string, putting the desired variables in between the strings and than concatenating it all together.

C# Code Snippets @ and String Literals

C# @ And String Literals

In this tutorial, we will take a look at string literals and the @ character in C#. In C# the @ character can either be used to make reserved keywords available as variable names or it can be used to make a string literal. A string literal takes everything in the string literally. For example, you do not have to escape a \ with \\ . Your string can now also span multiple rows in the editor. This can be useful when making SQL statements or HTML, XML, …

C# Code Snippets Break and Continue

C# Break and Continue

In this code snippet, we will take a look at break and continue in C#. break is used to break out of a code block. If done in a loop it will essentially stop the loop from executing. continue is used to inside a loop to skip the current iteration.

C# Code Snippets goto Keyword

C# goto Keyword

In this code snippet, we will take a look at the goto keyword in C#. goto is used to move the control of your program to a label you define beforehand. This can be useful to get out of nested loops, if statements or any nested code blocks in general. You can even make a DIY loop or method using the goto keyword 😁(But you should of course use the regular loops and methods).

C# Code Snippets TPL(Task Parallel Library) and Tasks

C# TPL(Task Parallel Library) And Tasks

In this code snippet, we will take a look at the TPL(Task Parallel Library) in C#. If you read some of my other posts on threading you will know that it can be quite complicated and laborious for the developers to implement parallelism into their programs(deadlocks, cancellation, thread pooling, getting data back from the thread, …). The Task Parallel Library(TPL) takes care of a lot of these things and or makes them easier manage.

Advertisment ad adsense adlogger