Important PHP string functions

PHP string functions:
In this post we will look at some commonly used functions to manipulate strings.

Note: It is important for Interview questions.




strlen() function in PHP:
The PHP strlen() function returns the length of a string.
The example below returns the length of the string "Welcome to PHP":

Example

<?php

echo strlen("Welcome to PHP"); // OUTPUT: 14

?>

In above example "Welcome to PHP" this parameter passed to strlen() function and we used echo statement so it prints 14 as a output.
Welcome=7
to=2
PHP=3
2 sapces.

strtoupper() function in PHP:
The strtoupper() function converts a string to uppercase.
Example
Convert all characters to uppercase:

<?php

echo strtoupper("Hello WORLD!"); 
// OUTPUT: HELLO WORLD!

?>

strtolower() function in PHP:
The strtolower() function converts a string to lowercase.
Example
Convert all characters to lowercase:

<?php

echo strtolower("Hello WORLD."); // OUTPUT: hello world.

?>

ucfirst() function in PHP:
The ucfirst() function converts the first character of a string to uppercase.
Example
Convert the first character of "hello" to uppercase:

<?php

echo ucfirst("hello world!"); // OUTPUT: Hello world!

?>


ucwords() function in PHP:
The ucwords() function converts the first character of each word in a string to uppercase.
Example
Convert the first character of each word to uppercase:

<?php

echo ucwords("hello world"); // OUTPUT: Hello World!

?>

strrev() function in PHP:
The PHP strrev() function reverses a string:
Example:

<?php

echo strrev("Vanesh"); // OUTPUT: hsenaV

?>

strpos() function in PHP:
The PHP strpos() function searches for a specific text within a string.
If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.

The example below searches for the text "world" in the string "Hello world!":

Example
<?php

echo strpos("Hello world!", "world"); // OUTPUT: 6

?>

str_replace() function  in PHP:
 - Replace Text Within a String
The PHP str_replace() function replaces some characters with some other characters in a string.

The example below replaces the text "world" with "Dolly":

Example
<?php

echo str_replace("world", "Vanesh", "Hello world!"); 
// OUTPUT: Hello Vanesh!

?>

strstr() Function in PHP:

Example
Find the first occurrence of "world" inside "Hello world!" and return the rest of the string:

<?php

echo strstr("Hello world!","world");

?>

OUTPUT: world!
The strstr() function searches for the first occurrence of a string inside another string.
This function is case-sensitive. For a case-insensitive search, use stristr() function.
Important: It returns the rest of the string (from the matching point), or FALSE, if the string to search for is not found.

str_repeat() function in PHP:
Repeats a string a specified number of times.

Example
Repeat the string "v" 10 times:

<?php

echo str_repeat("v",10); 
// OUTPUT: vvvvvvvvvv

?>

substr() function in PHP:
The substr() function returns a part of a string.

Example
Return "world" from the string:

<?php

echo substr("Hello world",6); 
// OUTPUT: world

?>

Above php string functions are very important, and important for Interview Questions.


Job Openings at Gatitaa, Pune

Job Openings at Gatitaa, Pune

About Company:
Gatitaa is Pune based IT service provider organization started in mid-2005, and is ISO 9001:2008 certified in January 2014. Gatitaa is achieving the real success of business in website design and development, software development, application development, E-commerce development, SEO/SMO, digital marketing, bulk messages and voice calling, product testing, logo design, brand development and much more. Gatitaa has catered 300+ customers and count is increasing significantly. We understand the requirements and business objectives and recommend a cost effective solution with latest technologies within the deadline. We follow Google standards, W3C standards.

Job Openings:

1. Website Designer

Required Skills: HTML, CSS, bootstrap, javascript, jquery, photoshop, (PHP, MYSQL will be benefitial)

Experience: 0 to 6 months


2. Marketing candidates : MBA, BBA (internship available)

Send resume: contact@gatitaa.com

Visit website: www.gatitaa.com

Services provided by Gatitaa :

1. Website Design / Development
2. Software Development
3. Domain Registration
4. Hosting
5. Social Media Marketing
6. SSL Certificates
7. Bulk Email/ SMS
8. ISO / SSI Certificates
& All Work Related to IT





DBMS interview questions with answers

For FRESHERS:
DBMS interview questions with answers



Question: What is database?
A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose.

Question: What is DBMS?
It is a collection of programs that enables user to create and maintain a database. In other words it is general-purpose software that provides the users with the processes of defining, constructing and manipulating the database for various applications.

Question: What is a Database system?
The database and DBMS software together is called as Database system.

Question: What are the advantages of DBMS?
Redundancy is controlled.
Unauthorized access is restricted.
Providing multiple user interfaces.
Enforcing integrity constraints.
Providing backup and recovery.

Question: What are the disadvantage in File Processing System?
Data redundancy and inconsistency.
Difficult in accessing data.
Data isolation.
Data integrity.
Concurrent access is not possible.
Security Problems.

Question: Describe the three levels of data abstraction?
The are three levels of abstraction:
Physical level: The lowest level of abstraction describes how data are stored.
Logical level: The next higher level of abstraction, describes what data are stored in database and what relationship among those data.
View level: The highest level of abstraction describes only part of entire database.

Question: What is Object Oriented model?
This model is based on collection of objects. An object contains values stored in instance variables with in the object. An object also contains bodies of code that operate on the object. These bodies of code are called methods. Objects that contain same types of values and the same methods are grouped together into classes.




For Interview questions and answers read these posts:

Most Important iOS Interview Questions:

Tell me about Yourself

50 Important C Language Interview Questions with Answers


After completing IT graduation or IT post graduation

This post is for career guidance for IT students.


After completing your education of IT or computer you are looking for job and you are going start for interview preparation.

Tips for after competing graduation or post graduation for IT students or freshers.

- You should prepare good resume. For resume tips read this post: Resume tips
- Check for spelling errors and grammatical mistake before you take a final copy of your CV as even a small error could cause an embarrassing situation for you.
- You should be ready with your platform. Platform means: in which language or specific field you want to do job. choose specific language. Decide on the basis of your interest. If you are good in coding you will be applying for developer or programmer post. If you want to become tester you have to to good course from reputed training institute.
- Various programming and development technologies exists, like,
Java, PHP, asp dot net, C, C++, Android development, Ios app development, game development, desktop app development, animation, photoshop, web design, web development, etc.
- Choose any one or two from above, and start to practice on the same.
- Start preparing interview questions. For interview questions visit or read this:
- Confidence is one thing, and this will be with you for your success.
- Register on Job Portals, upload your resume on job portals.
- Keep updating your resume on job portal at least weekly.
- Make list of IT companies, and hit the websites of these IT companies, go to career page of these websites and upload resume.
- Find HR email Id of IT companies and send resume with proper subject and message body.
- Be ready to go interview if they call back you.
- Before going for an interview, find out as much information on the company.
- Take guidance of your seniors or friends who are already working in IT companies.
- Don't be frustrated in any case, don't quit, Don't give up in any case.
- Try, try, try,...
- If you are frustrated, don't worry, motivate yourself by reading some good books.
- And you don't have option for doing job, you have to do job.
- Don't quit learning, Don't quit practice.
- Your resume should contain at least one project.
- Freshers need to ready for aptitude test.
- Self motivation is very important.


Most important for freshers:

Tell me about Yourself

PHP: Past, Today and Future

Important:
If you want to learn PHP, for getting job, comment here:
Complete training will be provide relatedto PHP, mysql, PHP framework like CodeIgniter. Full support for Interview preparation.
Complete help for project preparation, to include in resume.

Are you interested to learn PHP?
contact: hellotechnologypark@gmail.com

One PHP developer having 2.6 years exp. will guide you completely. Provide friendly training of PHP.

Gatitaa - Website Development company in Pune

Gatitaa is Pune based IT service provider organization started in mid-2005, and is ISO 9001:2008 certified in January 2014.Gatitaa is achieving the real success of business in website design and development, software development, application development, E-commerce development, SEO/SMO, digital marketing, bulk messages and voice calling, product testing, logo design, brand development and much more. Gatitaa has catered 300+ customers and count is increasing significantly. We understand the requirements and business objectives and recommend a cost effective solution with latest technologies within the deadline. We follow Google standards, W3C standards.


Services provided by Gatitaa, Pune :

1. Website Design / Development
2. Software Development
3. Domain Registration
4. Hosting
5. Social Media Marketing
6. SSL Certificates
7. Bulk Email/ SMS
8. ISO / SSI Certificates
& All Work Related to IT


Company Website:
https://www.gatitaa.com/



Contact for Jobs:
Email : career@gatitaa.com




Interview Tips for freshers

Here I am writing interview tips for freshers.




All IT guys who are looking for job are please note this tips, that are very important.

- Be on time  for interview.
- Be ready with all documents.
- Keep updated resume print ( at least 3 copies of resume) with you.
- Keep at least 3 passport size photographs with you.
- Read job description, eligibility criteria before going for interview.
- Use google map for locating interview address or contact concern person for address. You can find friend if any who are working for the same company.
- Check, recheck resume for any spelling mistakes. specify correct contact details in resume.
- Be formal, be professional, wear clean and well ironed dress.
- dont wear dark color dress.
- dont wear sleeper chappals.
- Be read for any type of test for interview.
- eat enough like breakfast before going to interview.
- Keep water bottle with you.
- Well prepared with possible interview questions.
- Don't discuss with other guys at the interview place, cameras are watching you.
- Don't try to cheat interview panel.
- Be honest through out the interview process.
- Again be prepared with technical concepts.
- Be ready with this question: Introduce yourself

Read this: Tell me about Yourself
Good Luck.




Important Links:

PHP interview questions with answers.

Software testing interview questions

OOPs Interview questions

Most Important iOS Interview Questions:

How to print in php: echo and print in php

Today we are going to learn how to print in PHP.




echo in PHP:
The echo() function outputs one or more strings. Return Value: No value is returned.

example:

<?php
echo "Hello world!";
?>


Output:
Hello world!

other example:
<?php
$foo = "foobar";
$bar = "barbaz";
echo "foo is $foo"; // foo is foobar
?>


other example: Join two string variables together
<?php
$str1="Hello world!";
$str2="What a nice day!";
echo $str1 . " " . $str2;
?> 


output:
Hello world! What a nice day!

Tip: The echo() function is slightly faster than print().


print() in PHP:
The print() function outputs one or more strings. It always returns 1.

example:

<?php
print "Hello world!";
?>


Output:
Hello world!

Tip: The print() function is slightly slower than echo().



Learn PHP: read and understand these posts:

Learn PHP : PHP variables
How to find PHP version through command prompt in windows?
Learn PHP: Hour 1
Learn PHP: Hour 2

Important PHP interview questions for freshers











MOST IMPORTANT INTERVIEW QUESTIONS PHP

QUESTION. How to include a file to a php page?
Answer. We can include a file using "include() " or "require()" function with file path as its parameter.

QUESTION. What is difference between “include” and “require” in php?
Answer. The include and require statements are identical, except upon failure:

require will produce a fatal error (E_COMPILE_ERROR) and stop the script
include will only produce a warning (E_WARNING) and the script will continue

QUESTION:  What are the different errors in PHP?
Answer. There are 4 basically types of error.
Parse Error – Commonly caused due to syntax mistakes in codes e.g. missing semicolon, mismatch brackets.
Fatal Error – These are basically run time errors which are caused when you try to access what can’t be done. E.g. accessing a dead object, or trying to use a function that hasn’t been declared.
Warning Error – These occurs when u try to include a file that is not present, or delete a file that is not on the server. This will not halt the script; it will give the notice and continue with the next line of the script.
Notice Error – These errors occurs when u try to use a variable that hasn’t been declared, this will not halt the script, It will give the notice and continue with the next line of the script.

QUESTION: What is session and why do we use it?
Answer. Session is a super global variable that preserve data across subsequent pages. Session uniquely defines each user with a session ID, so it helps making customized web application where user tracking is needed.

QUESTION: What is cookie and why do we use it?
Answer. Cookie is a small piece of information stored in client browser. It is a technique used to identify a user using the information stored in their browser (if already visited that website) . Using PHP we can both set and get COOKIE.

To read all PHP interview questions click here.









Learn PHP : PHP variables

Considering you know the installation and configuration of WAMP or XAMPP, and you have setup your PHP on your local machine.

This is guidance for candidates who really want to learn PHP.

So, Start.
Before you continue you should have a basic understanding of the following:
  • HTML
  • CSS
  • JavaScript




We are starting with variable.

What is PHP variable?
Answer: Variables are "containers" for storing information.

In PHP, a variable starts with the $ sign, followed by the name of the variable:

Example

<?php
$txt = "Hello world!";
$x = 10;
$y = 20;
?>
In above example, $txt is variable, which stores value "Hello word!". 
$x and $y also variables and they stores value as 10 and 20 respectively.

Note that when you are going to store string or text in variable do include that string in single quote or double.

If you want to store integer value in variable don't use quotes.

Using that variables as for example:

<?php
 echo $txt; 
echo "<br/>";
echo $x;
echo "<br/>";
echo $y;
echo "<br/>";

$z=$x$y;
echo $z;

 ?>

Output:
Hello word!
10
20
30

Explaination:
echo is construct we use to print in PHP. There is <br/> tag used with this echo that is for print new line.
$z stores sum of $x and $y.

In PHP we don't specify data type of variable, it automatically recognize.

That's it for this post, will post something important in next post, stay connected.

How to find PHP version through command prompt in windows?

How to find PHP version through command prompt in windows?



This question may get asked in PHP interview.

You just need to find out where is your PHP folder. If you are using XAMPP or WAMP then you will see a php folder. You just need to go into the php folder as:
 xampp -> php
wamp -> php

Now open command prompt here, And then just type in this command as :

   C:\xampp\php>php -v

    Then you will see something like:

PHP 5.5.19 (cli) (built: Nov 12 2014 12:35:44)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies


C:\xampp\php>

Your command prompt window should like this:


----
Keep reading, keep learning.

PHP Developer Salary: How much does a PHP Developer make?





In India, It's depends upon company, location and your skills. An average starting annual salary of php developer is near to 90,0000 INR that goes up to 4.50 lakhs in a three years of time.

In India, starts from as low as 8k/month to as high as 1.5L/month. Although low paying sections are more occupied.

As a programmer you need to have a very good understanding of how development technologies works in general and how are they co-related.

Summary:
For Freshers its 8-12K.
After 1 year - 16K
After 2 year - 22K
After 3 Year - 30K
After 4 Year - 36K
After 5 Year - Upto 45K
-60K


PHP Developer Salary depends on experience, logic, ideas, innovation, contacts, business development etc etc stuff. 

Learn and earn.