Tag

php functions

Browsing

Share Your Website Post To Social Media using php

Share your website post to social media using php. Everyone want to share their post in social media regularly to get increase the page views and also website view. So the social media is the best way to promote our content to reach everyone. When ever we write our post we directly update this post into our social media using php

Here I am written sharing code, Just click social media icons it will share automatically to your social media timeline

Here I have get our website details description and content using php

Here we going to add Facebook and Google plus sharing

Add Javascript for sharing link
Het your facebook api id from the developers facebook page

Find how to get app id – Here

Here we added the javascript for post article. now you can used ur post to share in social media

Dynamic dependent dropdown select list using jquery and php

In this tutorial we are going to see how to change states drop down list ans city drop down list option based on the dropdown select country name. we are going use jquery and mysql database for select country and retrieve state data. means Loading records from database dynamically and display it in select box without refreshing the whole page with the help of Ajax and jQuery and PHP code.  country state city Dropdown, using ajax and jqurey fill country state city dropdown.  Ajax country state city dropdown php, onchange in jquery, dynamic dropdown.

Step 1:  Create database and database table With content. Create database name “Country_db” and table with Country, state and city

Country table:

Cities Table

States Table

Step 2: Database Config

Step 2: Create the index page

Step 3: create jquery with ajax function to pass country id into next page and select state and cities form the database table

Ajax page for select database of cities and states

That’s it enjoy the code. demo and download the script and use it easily. Feel free to comment your suggestions regarding this tutorial. Subscribe me. 

Here we going to learn simple javascript calculator code. Generally for beginners, they think its difficult to writing code for calculator. But its not that much difficult in the codding.
We just know only simple things in function like add, sub, mutli and div functions in php. If you know that then the calci code is very simple, you may try it now
javascript calculator code

Step 1:
First create html file

Step 2: Add Css file for the page

Step 3: Add javascript for the calci function.

Here the Demo –

See the Pen KpvNZR by Rajaseka G (@SekarG) on CodePen.

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

 

In the Given example, we have to find whether  “CSS” Find or not in the array. It prints the key of the value.

Output

b   // output

Explaination

array_search is used to search the array value(‘css’) and returns the value’s key(‘b’);

2. In_array()

In_array is simillar to the array_search

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

you can search anything value or key using IN_ARRAY();

for example

have to find “Developerdesks” in the given array

 

You can see explanation in this url

 

Function to find particular value or key in the array for php – In_array

In_array Functions is used to find the value in the array list

using this function you can find the value is present or not in array queue.

syntax: In_array();

for example

have to find “Developerdesks” in the given array

Explanation:

If you want find a particular key or value in the very long array for any action..

here ‘raj’ is ‘key’ and  ‘1233’ is ‘value’

you can search anything value or key using IN_ARRAY();

Similar to In_array();

2. array_search() 

If we have a very large array values in Indexed or Associative array, we have to search or filter the particular array value or key.

Array_Search function is used to find the value.

This  function used to  search an array for a value and returns the key.

You can see Explanation Here

A multidimensional array is an array containing one or more arrays.

Three-Dimensional array

For three dimensional array u have to use two for loop condition
find 0 indexed array value and then 0 indexed array value

Explain

First foreach consider skill as $develop and php =>80 as $desks

Second For each consider $key as php and $ value as 80

so the $develop –> indexed as skill, $key–> indexed as php and $value indexed as 80

simple foreach concept worked

Output

 

Similar like three dimensional array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

1.Two-dimensional array

Output

Explanation:

First For loop consider all array values inside the array  –> array(“developer”,php,html) as 0 indexed

Second For loop consider inside values –> Developer as 0 indexed

For two dimensional array u have to use two for loop condition

find 0 indexed array value and then 0 indexed array value

simple example

Example For Three-Dimensional array

Associative array is array that use named keys that you assign to them.

example

named key ‘raj’ has vlaue ‘123’;

IF the named key is unknown and unlimited the use foreach

output

Similar like Associative array

Multidimensional Array concept in Php

A multidimensional array is an array containing one or more arrays.

Its is solution for to know how to handle a array with in array
Example
1.Two-dimensional array
2.Three-dimensional array

Here You can see Exaplaination

 

How to use for loop concept for php using find array values

for loop is used to initialize the code for how many times it should run.

syntax

for (initialization counter; total counter; increment counter) {
    code to be executed;
}

for example

output

for loop php is used to count and auto increment the array values using loop.

What is Array?

An array is a variable, which can hold more than one value at a time.
php Array basic function defined as
array();

example

For more explanation about array

How to print array values indexing in php using Indexed array

Indexed array is array with a numeric index. Index will Start with ‘0’ and it can be assigned automatically

example

If you know the total number of array values means you can do like this,

For unknown and unlimited array values are present then go to Forloop

Example

To know the array total values use count(); Functions

 2. Count();

This Function is used to fin the count of array key in the array.

3. Associative array()

Associative array is array that use named keys that you assign to them.

example

For more Explanation click here