Showing posts with label break. Show all posts
Showing posts with label break. Show all posts

Wednesday, June 15, 2016

break statement

The break statement, though, enables you to break out of a code block.
Usually we use this in switch..case block. But we can use in loops as well as in the example below:

<?php
$i = -4;
for ($i ; $i <= 10; $i++ ) {
if ( $i == 0 )
break;
$temp = 1000/$i;
print "1000 divided by $i is... $temp<br>";
}
?>

save it as break.php and open from your browser.
We use break statement if we want to get out of a code block for probably to get rid of logic error such as division by zero or anything else.

The result should be like this:

1000 divided by -4 is... -250
1000 divided by -3 is... -333.33333333333
1000 divided by -2 is... -500
1000 divided by -1 is... -1000

The loop stop when $i equals to 0 (zero) and the loop gets out of the loop block.

Friday, June 10, 2016

PHP Text Splitter Break Plain Text Into Separate Sentences

PHP Text Splitter gets plain text as input and breaks it into separate sentences. Smart logic implemented to catch abbreviations. Supports custom sentences separator.

Each sentence must start with uppercase letter in order to be parsed correctly.

This tools consists of only one php file, and does not need any third party components.

Download PHP Text Splitter PHP Script