game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online game.onenall.com,play free game online

how to break a sentance after some words using php

wordrap php

Today we will see how to break a sentance after some characters using php.

Sometime we need to break a long line into small peaces of sentence to meet the designing   requirement. PHP has very good function wordwrap() to meet the req.

Basic sentance of the wordwrap() php function

string wordwrap ( string $str [, int $width = 75 [, string $break = "\n" [, bool $cut = false ]]] )

So u can see by default, wordwrap() uses a column width of 75 characters. This means that no line will be more than 75 characters long.

Wrapping very long words

For example suppose we have a sentance:

$sentance = ‘JohnCleese: Have you signed up to my monthly email yet? Youre missing outif you havent http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.co.uk/‘;

echo "<pre>" . wordwrap( $sentance, 10 ) . "</pre>";

output will be: 
JohnCleese:
Have you
signed up
to my
monthly
email yet?
Youre
missing
outif you
havent!

http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.co.uk/

So you can see the problem at last sentence.

To make this work perfectly use the sentence like this

<?
$sentance = 'JohnCleese: Have you signed up to my monthly email yet? Youre missing outif you havent! http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.co.uk/';
echo "<pre>" . wordwrap( $sentance, 10, "\n", true ) . "</pre>";
?>

Output will be like:

JohnCleese
: Have you
signed up
to my
monthly
email yet?
Youre
missing
outif you
havent!

http://aaa

aaaaaaaaaa
aaaaaaaaaa
aaaaaaaa.c
o.uk/

So clear now.
Thanks
mrphpguru
http://www.mrphpguru.com


how to check weather session started

how to check weather session started

/**
* Check to see if the session exists, if not, start it
*/
if((!is_array($_SESSION)) xor (!isset($_SESSION['nzshpcrt_cart'])) xor (!$_SESSION)) {
session_start();
}
?>

see the small example to check weather session has been started or not.

thanks
mrphpguru

php Vs perl – why php better than perl





php Vs perl – why php better than perl

PHP is another computer language. In a way, Perl and PHP are competitors in the programming world. Both languages have relatively similar learning curves, work well in the server environment, and have similar overall capabilities.

As you would expect, each language has its pros and cons. Ideally the webmaster would be able to use either language and choose the best one for a given project. However most programmers have a preference for one over the other and will tend to use their favourite.

In recent years PHP has become more popular with new programmers, in particular, web designers learning their first programming language. This may be because PHP is slightly easier to learn from a web design point of view. PHP pages are constructed like HTML pages, with standard HTML markup. PHP code is inserted into the page and executed when the page is requested. Conversely, Perl scripts are run as stand-alone programs and create HTML pages when the script is run.

Another issue is speed and efficiency. PHP is generally considered to be faster than Perl, although this is debatable. In any case there are certainly ways to make Perl perform as fast. PHP supporters often cite speed as a good reason to choose PHP, but in reality it is not normally a concern and any differences are usually academic.

Perl is a very powerful, robust language with more history than PHP. Although the newbie might think that Perl is more complicated than it needs to be for web development, experienced programmers will appreciate the vast array of options available with Perl.

In our opinion….

In regard to web development, we have yet to find a single thing that Perl can’t do, whereas we have found limitations in PHP. We feel that the added power of Perl makes it the better choice. We have not found the efficiency issue to be much of an issue at all – in most cases it’s only academic and won’t actually affect the performance of your website.

In the end, either language will be adequate for most web development requirements.

source: mediacollege.com

thanks

mrphpguru

–>ZOAEX-Ribbon http://bit….





–>ZOAEX-Ribbon http://bit.ly/cHbWAJ

RT @oneanallsms Excellence is …





RT @oneanallsms Excellence is not a one-time achievement- Inspirational Quote of the Day http://bit.ly/a7BLec

HI i am chking TweetDeck soft…



HI i am chking TweetDeck software.thanks



I just downloaded the @iamtrav…

I just downloaded the @iamtravisporter #ProudToBeAProblem mixtape. GET YOURS HERE http://bit.ly/proudtobeaproblem

RT @oneanallsms bouquet of lov…





RT @oneanallsms bouquet of love -Anniversary SMS http://bit.ly/9OXRS7

GreenField Racergame,games,car…

GreenField Racergame,games,car games,bike games,racing games,3d games, free games,2d games,play fr.. http://bit.ly/9M2ZS4

RT @oneanallsms Bret Michaels …

RT @oneanallsms Bret Michaels – Story of My Life http://bit.ly/9bLYS5