Friday, December 13, 2013
Wednesday, December 11, 2013
The explode Function in PHP
PHP Code:
$rawPhoneNumber = "800-555-5555"; $phoneChunks = explode("-", $rawPhoneNumber); echo "Raw Phone Number = $rawPhoneNumber <br />"; echo "First chunk = $phoneChunks[0]<br />"; echo "Second chunk = $phoneChunks[1]<br />"; echo "Third Chunk chunk = $phoneChunks[2]";
Display:
Raw Phone Number = 800-555-5555
First chunk = 800
Second chunk = 555
Third Chunk chunk = 5555
First chunk = 800
Second chunk = 555
Third Chunk chunk = 5555
explode Function - Setting a Limit
PHP Code:
$someWords = "Please don't blow me to pieces.";
$wordChunks = explode(" ", $someWords);
for($i = 0; $i < count($wordChunks); $i++){
echo "Piece $i = $wordChunks[$i] <br />";
}
$wordChunksLimited = explode(" ", $someWords, 4);
for($i = 0; $i < count($wordChunksLimited); $i++){
echo "Limited Piece $i = $wordChunksLimited[$i] <br />";
}
Display:
Piece 0 = PleasePiece 1 = don't
Piece 2 = blow
Piece 3 = me
Piece 4 = to
Piece 5 = pieces.
Limited Piece 0 = Please
Limited Piece 1 = don't
Limited Piece 2 = blow
Limited Piece 3 = me to pieces.
Subscribe to:
Posts (Atom)
Labels
AJAX
(1)
Answers
(1)
Apache
(1)
Array
(16)
bug
(1)
C
(1)
C++
(1)
Calendar
(1)
Class
(1)
Commands
(1)
Cookies
(2)
Database
(2)
Date
(7)
Days
(1)
explode
(1)
File Upload
(1)
FILES
(1)
firewall
(1)
fix
(1)
Functions
(26)
GET
(1)
GMT
(1)
JavaScript
(2)
localhost
(1)
Mail
(1)
Menu
(1)
MYSQL
(13)
PERL
(1)
PHP
(36)
php.ini
(1)
POST
(1)
preg_match
(1)
Questions
(1)
Script
(1)
SMS
(2)
Solution
(1)
String
(1)
Time
(5)
Time Zone
(1)
Vista
(1)
Wamp Server
(1)
windows 7
(2)
XML
(1)
Popular Posts
-
Creating a registration form using PHP in PHP Form Creating a membership based site seems like a daunting task at first. If you eve...
-
Send SMS through way2sms using php 1. download one rar file - click here to download 2. extract the rar file 3. ...
-
Making a login form using PHP in PHP Form This is in continuation of the tutorial on making a membership based web site. Please see t...
-
Syntax array array_diff ( array $array1, array $array2 [, array $array3 ...] ); Definition and Usage Compares array1 against array2...
-
How to Find and Replace Text in MySQL Database using SQL ...
-
<? /* Simple and easy for modification, PHP script for SMS sending through HTTP with you own Sender ID and delivery reports. You just ...
-
There are two ways the browser client can send information to the web server. The GET Method The POST Method Before the browser sends...
Popular Posts
-
Send SMS through way2sms using php 1. download one rar file - click here to download 2. extract the rar file 3. ...
-
<? /* Simple and easy for modification, PHP script for SMS sending through HTTP with you own Sender ID and delivery reports. You just ...
-
Creating a registration form using PHP in PHP Form Creating a membership based site seems like a daunting task at first. If you eve...
-
if ($_POST['Date'] == "") { $Date = ''; } else { $Date = $_POST['Date']; } list($Day,$Month,$Year)=...
-
Calculate No Of Days Excluding Weekends Count the number of days between two dates that exclude weekends as non work days Count...
-
Loading a Drop Down List Using jQuery in jQuery To load a drop down list (or a simple list) from a database, there are different wa...
-
More about forms Transmission methods HTTP, the transmission protocol used for the Web, actually defines two methods for sending form i...
-
Making a login form using PHP in PHP Form This is in continuation of the tutorial on making a membership based web site. Please see t...
-
The SELECT statement is used to select data from a database. Select Data From a Database Table The SELECT statement is used to select...
-
What is php? and please explain? PHP, or PHP: Hypertext Preprocessor, is a widely used, general-purpose scripting language that was...