Numerous content management systems provide various ways through which developers can alter the content of a web page through plugins or other types of extensions. In today's tutorial I will show you how an article that is loaded from an external source can be modified using the DOMDocument Class in PHP.
DOMDocument is part of the DOM PHP extension, which allows operations on XML / HTML documents using its API. DOMDocument actually represents an entire HTML or XML document. We will be loading it from an existing URL or file. If you are loading the HTML from the database, just replace the
loadHTMLFile() method with
loadHTML($html_string) which takes an HTML string as a parameter.
In this lesson, you will learn how to upload image files to the server with PHP. Specifically, you will go through every required validation that should be done when uploading files to the server.
This will make your upload scripts maintainable and most importantly secure.Read Full Article...
In this tutorial I will try to teach you about the basic uses of closures (aka anonymous functions) in PHP. You will learn how closures are used as callback functions and how they can inherit variables from the parent scope.
Closures have been introduced in PHP 5.3 and their most important use is for callback functions. Basically a closure in PHP is a function that can be created without a specified name - an anonymous function. Here's a closure function created as the second parameter of
array_walk(). By specifying the
$v parameter as a reference one can modify each value in the original array through the closure function.
Can't remember your password ?
Reset it using the form below:
Fill the form below to create
an account with codepunker.com