How to remove all white spaces within a string using PHP

There are two functions that could be used namely str_replace and preg_replace. First, we’ll give an example using str_replace. str_replace is the preferred method since it’s faster and easier to use than preg_replace which relies on regular expressions. str_replace (PHP 4, PHP 5) - http://de.php.net/manual/en/function.str-replace.php $string = "This is a test string"; $new_string = str_replace(' ','',$string); echo $new_string; //This will output Thisisateststring preg_replace (PHP 4, PHP 5) - http://php.net/manual/en/function.preg-replace.php $string = "This is a test string"; $new_string = preg_replace('/( *)/','',$string); echo $new_string; //This will output Thisisateststring or ...

March 22, 2018 · 1 min · 110 words · icarnaghan

How to remove duplicate values in a PHP array

Use the array_unique function array_unique (PHP 4 >= 4.0.1, PHP 5) array_unique (Takes an input array and returns a new array without duplicate values_)_ array_unique (array $array [, int $sort_flags=SORT_STRING ] ) Example: CODE: <?php //Array with duplicate values $array = array(“test”,“test1”,“test”,“sum”,“minus”,“max”,“max”,“max”,“min”); //Removing duplicate values $newArray = array_unique($array); echo ‘’; print_r($newArray); ?> **OUTPUT: ** //The above code will produce the following results without the duplicate values Array ( ...

March 22, 2018 · 1 min · 87 words · icarnaghan

How to remove the Album Art from all songs in a specific album simultaneously or from a selection of songs within iTunes 10

Open iTunes 10 On the left hand side select Music under Library Highlight all the songs within the Album that you wish to remove the Album Artfrom Right click on the song selection and select the first option GET INFO and click OK when iTunes asks you if you are sure that you want to edit multiple items click OK Check the checkbox next to Artwork and click OK Now all artwork for the song selection should be cleared

March 22, 2018 · 1 min · 79 words · icarnaghan

How to remove the first element of an array using PHP and then storing the element in a variable

By using the PHP function ‘array_shift’ we can remove the first value of an array array_shift - Shift an element off the beginning of array (PHP 4 & 5) Example: $array = array("apple","peach","pineapple","banana"); $first_element = array_shift($array); echo '<pre>'; print_r($array); echo '</pre>'; echo $first_element; In the above example we have an array with 4 values, now using the ‘**array_**shift’ function we remove the first value namely apple and store it in the $first_element variable. ...

March 22, 2018 · 1 min · 124 words · icarnaghan

How to remove values in one array from another array using PHP

Example: I have array A with values and another array B. I need to remove the values in array A from the values in array B. Use the PHP function array_diff Description array array_diff ( array $array1 , array $array2 [, array $ … ] ) Compares array1 against array2 and returns the difference. Parameters array1 = The array to compare from array2 = An array to compare against Code example below: ...

March 22, 2018 · 1 min · 134 words · icarnaghan

How to rename you iPhone

NOTE: This can only be done withing iTunes ‘Tested in iTunes 10’ Answer: Open iTunes and plugin your iPhone On the left hand side under DEVICES you will see your device, click on it to select it and then click on it again to rename it, similar to renaming files and folders in **Windows ** Give it your desired name and your iPhone will be renamed as soon as focus is on another area of the screen ...

March 22, 2018 · 1 min · 77 words · icarnaghan

How to set the Page Title in Yii Framework 1.1.x

In your main layout file always have the following code between the title tag in order to display the title <title><?php echo CHtml::encode($this->pageTitle); ?></title> Please note that conditional statements can also be use within the title tag to make displaying of the title more dynamic. You can set the title in your Controller or View files by using something similar like $this->pageTitle = 'My new page title'; NOTES: In the controller if the Page Title is not set Yii defaults the Page Title to the Controller and Action name ...

March 22, 2018 · 1 min · 129 words · icarnaghan

How to set the Theme in the Yii Framework on the Fly

Yii::app()->theme = 'ThemeName'; The above code can be set anywhere in your Yii Application to change the current Theme.

March 22, 2018 · 1 min · 19 words · icarnaghan

How to setup PostgreSQL on WAMP server

Ensure that PostgreSQL has been installed on your machine. The Windows installers can be downloaded from http://www.postgresql.org/download/windows/ Assuming WAMP Server is installed on c:\wamp, copy C:\wamp\bin\php\php5.4.3\libpq.dll to C:\wamp\bin\apache\apache2.4.2\bin\libpq.dll Also see that the following files exist C:\wamp\bin\php\php5.4.3\ext\php_pgsql.dll C:\wamp\bin\php\php5.4.3\ext\php_pdo_pgsql.dll The above two files are PHP extensions and should be enabled using the WAMP menu or the php.ini file

March 22, 2018 · 1 min · 56 words · icarnaghan

How to show the Battery percentage in iOS5

Go to Settings Then select General and then Usage Under Battery Usage turn on Battery Percentage

March 22, 2018 · 1 min · 16 words · icarnaghan