Sharp Tutorial
String in php

Python

Java

C

C++

HTML/CSS

Java Script

PHP

SQL

C Programs

PHP Introduction

  • PHP home
  • PHP introduction
  • How to install and run
  • Syntax and Rule in PHP
  • Data type and operator
  • If else in php
  • Loop in php
  • Array in php
  • Sring in php
  • Function in php
  • Include in php

Working with Forms

  • Get and Post
  • Get Form input into PHP
  • Form Validation

PHP with MySQl

  • Connect PHP & Mysql
  • Insert using PHP Mysql
  • Select using PHP MySql
  • Delete Update using PHP Mysql
  • Login Page Example in PHP

Advanced PHP

  • Session in PHP
  • Cookies in PHP
  • File Handling in PHP
  • File Upload/Download PH

Object Oriented PHP

  • Class Obejct in PHP
  • Constructor in PHP
  • Destructor in PHP
  • Inheritance in PHP

String in PHP

String in php declared in single quote or in double quote  as $name=”sharp”;

Functions on string

1 ) strlen: to fin the length of the string 

<?php
echo strlen("sharp tutorial!"); // outputs 14
?> 

2) str_world_count: to count the word in the given string
<?php
echo str_word_count("sharp tutorial!"); // outputs 2
?>

3) strrev: it reverse the given string
<?php
echo strrev("sharp!"); // outputs !prahs
?>

4) strpos: it gives the index of the given substring into main string
<?php
echo strpos("sharp tutorial", "tutorial"); // outputs 6
?> 

5) str_replace: it replace a given string with another string into the main string

<?php
echo str_replace("tutorial", "totorial", "sharp tutorial"); // outputs sharp totorial
?>  
6 ) strtolower: to convert the given string to lowercase.
<?php
echo strtolower(“SHARP”);// output sharp 
?> 

7)strtoupper: to convert the given string to upper case.

<?php
echo strtoupper(“sharp”);// output SHARP
?>  

8)substr: to find the substring into given string.

<?php
echo substr(“sharp tutorial”,2,3);// output arp
?>  

 

above program shows the following string functions output.

Enquiry about Course

Ask your Question

Click Here

Sharp (2) Tutorials

Video/ C Introduction

Watch video in full size

Video tutorial

Follow by Email
Facebook
Facebook
fb-share-icon
YouTube
Copyright © Sharp Tutorial
Build with WordPress
Wordpress Social Share Plugin powered by Ultimatelysocial
Sharp Tutorial