Category "php"

PHP only Hit Counter?

So, I used to play with web development many years ago, and I'm a little rusty, but not THAT rusty! I just made a full fledge video game page the other day usi

Populate Dynamic Dropdowns List in Codeigniter

Database inlcude Groups like Arts,Science and IT.By Choosing one Group Second Dynamic Dropdown appear which will show the Subjects Related to Group. This is my

How to change HTML structure inside WP <head>

I'm cleaning up some HTML code, and I would like to have a HTML structure that looks like this: <!DOCTYPE html> <html > <head> <title>.

Laravel - How to properly generate unique slugs from article titles?

I need to generate unique slugs based on titles of articles. For matching slugs I want to append a number to the end to make them unique. I made this function b

generating a random code in php?

i know this might seem silly, but i want to generate a random code of 8 characetrs, only numbers or letters using php. i needs this to generate a password for e

Submitting a form with ajax in Wordpress

I am trying to get the results of an ajax request in wordpress, but I am getting result of '0' in an alert box of javascript, so the form looks like this: <

Laravel Route issues with Route order in web.php

I have problem with routes in Laravel, I'm following one tutorial and we have this routes listed in web.php file Route::get('/home', 'HomeController@index')-&g

Submitting a form with ajax in Wordpress

I am trying to get the results of an ajax request in wordpress, but I am getting result of '0' in an alert box of javascript, so the form looks like this: <

Get image type from base64 encoded src string

WHAT I REQUIRE My image src looks like this data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAA... How can I extract the image type ie; jpeg from the above src g

how to create html table in php

I have the following snippet of code that basically uses explode to split out these values: <?php $data=array(); $Inputfile = file("prod.txt"); foreach ($In

Adding Multiple Custom Post Types in Wordpress

I was fine with adding one custom post type (releases) to my functions.php file, but then adding a second (projects) seems to have complicated things. The pro

Wordpress add responsive srcset header image to theme

WP introduced support for srcset in version 4.4 for Thumbnails and Post images. But I can't find a way to make the page header responsive. Here is how I embed t

woocommerce change position of price

I get this error when trying to render the product price before the main content on the page. Fatal error: Uncaught Error: Call to a member function get_price_

PHPUnit (Phar) Fatal Error Only When Test Fails

I have chosen to use a Phar of PHPUnit (phpunit-4.8.26.phar) to unit test my custom built PHP Framework and Application. The reason I am using the old stable re

Regex to find or extract strings between the "<>" angle brackets

In the following string, Jason <[email protected]> how can I extract the part inside the angle brackets? I tried <\w> and it didn't work. Ideas

PHP random string generator

I'm trying to create a randomized string in PHP, and I get absolutely no output with this: <?php function RandomString() { $characters = '01

How should I get started using PHPUnit as a testing framework for a bunch of functions and classes I have already made?

I've already read the documentation. Basically I've tried tests while following the BankAccount example. But I get errors: Warning: require_once(PHP/CodeCovera

phpunit - mockbuilder - set mock object internal property

Is it possible to create a mock object with disabled constructor and manually setted protected properties? Here is an idiotic example: class A { protected

Comma separated list from array with "and" before last element

I have an array ($number_list) that has a dynamically generated list of values. There will be at least 1 value in the array and no more than 4. Currently, I ha

dompdf and img tag, image wont show

Here is the HTML just before $dompdf->render() and $dompdf->output() are called: <img src="http://www.example.com/images/Logo.png" /> All other i