Thursday, October 1, 2020

PHP spliti() Function



Hello dear readers! welcome back to another section of my tutorial on PHP. In this tutorial guide, we will be discussing about the PHP spliti() Function.

The spliti() function operates in the same way as its peer split(), except that it is case-insensitive. Case insensitive characters are an issue only when the pattern is alphabetical. For other characters, spliti() operates the same way as split() does.

RECOMMENDED: PHP split() Function

Syntax

The following is the syntax for the spliti() function -

array spliti (string pattern, string string  [, int limit]);

Return Value

  • Returns an array of strings after splitting up a string.

Example

Following is a simple example -

<?php
   
   $ip = "123.456.789.000"; // some IP address
   $iparr = spliti ("\.", $ip, 3); 
   
   print "$iparr[0] <br />";
   print "$iparr[1] <br />" ;
   print "$iparr[2] <br />"  ;
   print "$iparr[3] <br />"  ;

?>

Output

When the above code is executed, it will produce only three strings as we have limited the number of strings that is to be produced -

123
456
789.000

RECOMMENDED POST: PHP ereg() Function

Alright guys! This is where we are rounding up for this tutorial post. In my next tutorial guide, we are going to be discussing about the PHP sql_regcase() Function.

Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.
Share:

0 comments:

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.