You are here: Daniel Dumas »

Blog

PHP Auto-Increment and Auto-Decrement Operators

The auto-increment operator designed to automatically increment the value of the variable it is attached to by 1. It is represented by a double addition symbol (++). To see it in action, run the following script:


<?php
// define $total as 10
$total = 10;
// increment it
$total++;
// $total is now 11

?>

Thus, <?php $total++; ?> is functionally equivalent to <?php
$total = $total + 1; ?>.
There’s also a corresponding auto-decrement operator (––), which does exactly the opposite:


<?php
// define $total as 10
$total = 10;
// decrement it
$total--;
// $total is now 9

?>

These operators are frequently used in loops to update the value of the loop counter.

PHP Logical Operators

Hey guys! welcome me back! yes, i am finally back again. i been away for a long time, but i am now back again in the blogosphere to share some PHP tutorials, tips and other web development ideas, tips and tricks etc.

for today i will discuss about PHP Logical Operators.

To link together related conditions in a simple and elegant manner, we can use Keep Reading…

CSS Stylesheet Switcher using PHP

Hi everyone! today I’ll teach you how to separate CSS stylesheet for your website or web projects. there are many ways to do this but I am going to use PHP for this tutorial.

As a Web Developer or Web Designer, it is important that website’s we develop are working on all major browsers, or on all(old or new) browsers if possible. but some browsers (specially the old one’s) has their own specific way Keep Reading…

WordPress Search and Replace

Hey everyone, I am alive again to blog after a long time haha welcome back to me. I’ve decided to blog again to make this site alive in search engines because i been out for a very long time, and my site traffic and ranks has decreased huhu.. alright so much for the blah blah..

well today I’ll share some ways on how to Search and Replace datas or texts in WordPress. this will be useful when you are transferring a wordpress blog from one domain to another or if you’ve developed a wordpress site on your localhost and you’re gonna upload it to an online server or on your own domain, of course you need to update the paths on your posts.

for example you’ve developed a wordpress site on your local machine and you installed it on http://localhost/wordpress, when you transfer the site into a live server, you need to change that path in your Keep Reading…

My First LightSpeed Store Project

I’m very happy I just finished my very first LightSpeed E-Commerce Project. at first it was really hard(as always), but I am more familiar and comfortable with it’s framework now, so I’m very ready for the next store project, hope that’d be soon..

Here is a screenshot of the website:

URL: http://noteworthystore.com

We are using MySQL, help save it

I, Michael “Monty” Widenius, the creator of MySQL, is asking you urgently to help save MySQL from Oracle’s clutches. Without your immediate help Oracle might get to own MySQL any day now. By writing to the European Commission (EC) you can support this cause and help secure the future development of the product MySQL as an Open Source project.

What this text is about:
- Summary of what is happening
- What Oracle has not promised
- Oracles past behavior with Open Source
- Help spread this information (Jump to ‘What I want to ask you to do’)
- Example of email to send to the commission (Jump to ‘send this to:’) Keep Reading…

PHP Operators: The === Operator

PHP’s === Operator enables you to compare or test variables for both equality and type. Refer below for example.

<?php
//define variables..
$str = '9';
$int = 9;

//Returns true since both variable contains the same value..
$res = ($str==$int);

//Returns false since the two variables are not of the same type..
$res = ($str===$int);
?>

PHP Operators : Using Comparison Operators

To compare php variables to determine whether they are the same or different.. you can use PHP Comparison Operators. See below for a list of examples..

I. Define the Variables

<?php
$num1 = 9;
$num2 = 9;
$num3 = 22;
?>

A. The Less Than Operator

<?php
//Returns true if variable in the left side is less than the right..
$res = ($num1 < $num3);
//returns true..
?>

Keep Reading…

PHP Operators: Using String Concatenation Operator

You can concatenate or add strings together using the PHP string concatenation operator represented by the period sign ( . ). refer to the examples below.

<?php
// intialize variables
$username = "daniel";
$domain = "danieldumas.com";

// the variable string $username and $domain can be combine using the concatenation operator
$email_address = $username . '@'. $domain;

//the variable $email_address now contains the value "daniel@danieldumas.com"

?>

You can also concatenate simultaneously. . Keep Reading…

PHP Operators : Using Arithmetic Operators

Using Arithmetic Operators in PHP you can perform mathematical operations on PHP variables. refer to the example below.

Using PHP Arithmetic Operator

//define variables
<?php

$num1 = 50;
$num2 = 30;

//Addition
$sum = $num1 + $num2;

//Subtraction
$difference = $num1 - $num2;

//Multiplication
$product = $num1*$num2;

//Division
$quotient = $num1 / $num2;

//Modulus
$remainder = $num1 % $num2;

?>

you may also use the shorthand using the PHP Assignment Operator and Arithmetic Operator together. Keep Reading…