Create Links in PHP

<a href=”https://premkatigar.wordpress.com/&#8221; target=”_blank”>Premal</a>
<?php
echo “Above text is link”;
?>

 

link

Advertisements

Changing the capitalization of stings

Making the string all capital letters:

You can simulate the CAPSLOCK key using thestrtoupper() PHP function.

Making the string all lower case letters:

You can also force all letters in a string to be lower case. This is done with the strtolower() PHP function.

Capitalizing each word:

You can choose to only capitalize the first letter of every word. This works great when working with a list of names or cities. This is done with theucwords() PHP function.

Code :

<?php

// using strtoupper() we can easily get all characters in capital.

echo strtoupper(“This is Premal Katigar”);

?>
<br>
<?php

// using strtoupper() we can easily get all characters in capital.

echo strtolower(“This is Premal Katigar”);

// using ucwords() we can easily get all words with first character capitalized

?>
<br>
<?php
print((ucwords(‘premal,katigar’)));
?>

capitalize all words

Output Of above code :

capitalized character output

 

Know More about php

Mail me your topic or problems

premalkatigar2@gmail.com

Contact : +91-84604-57306

How to use arrays in php

When you are working with PHP, one way to represent data is to use a variable. But sometimes a variable just isn’t enough. Sometimes you need an array. An array is sort of like a variable that holds multiple entries. For example, if you wanted a variable called $state you could only hold one state name. But if you made the same variable an array, you could hold all 50 states.

<?php  $state = "Premal";  echo $state;  ?>

If you run the code above it will simply return:

Premal

<?php  $states = array ('Bhavi', 'Premal');  print_r ($states);  ?>

If you run this you will see:

Array ( [0] => Bhavi [1] => Premal [2] )

All of the elements (the items in our array) are indexed by number. The first number is always 0.

Let’s try it:

<?php  $states = array ('Premal', 'Katigar');  echo ($states[1]);  ?>

Running this will display:

Katigar


<?php   $states = array('Developer' => 'Premal', 'Develop' => 'Paresh');   print_r($states);   ?>

Here is another way to define the same array:

<?php  $states['Developer'] = 'Premal';  $states['Develop'] = 'Paresh'  print_r ($states); ?>

Try this code:

<?php   $states = array('Developer' => 'Premal','Develop'=>'Angel');   echo ($states[Developer]);  ?>

Running this code will simply give you:

Premal