PHP - Add Period To End Of Sentence
How can I add a period at the end of the sentence with this..
Code: [Select] if($i > $max) break; if($i == $max || ($i == count($information) && $i > 1)) echo ' and '; else { if($i > 1) echo ', '; } if ($info[0] == 'credentials') { echo "credentials"; } if ($info[0] == 'specialties') { echo "specialties"; } if ($info[0] == 'stageofdevelopment') { echo "stage of development to {$info[1]}"; } $i++; Similar TutorialsCreate a data form that should accept odd number of words in a particular sentence
Input Example: I am working in retailon.
and should display the output as reversing first and last word and second word to fourth word
and so on and the middle word should be same and should also display the number of words.
Output Example: retailon in working am i.
words=5.
Input:I am Working in Google.
Output:Google in Working am I.
Words:5
I need to execute something after a specific sleep time Like a random function which display a random image into html every 2 min; But i don't know how to do the 'every 2 min' part How to write an IF condition for a specific time of day? e.g. between 18 and 18:30. To do something if the current time is between 18 and 18:30. Hello, While I am working on my code I faced this problem, which is Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\factory1.php on line 100 Call Stack # Time Memory Function Location 1 0.0062 379160 {main}( ) ..\factory1.php:0 Any help to come over this problem. My database is quite large (600 MB). Thanks in advance. like I said I'm not very good in coding. so your help to solve this one is more than appreciate. this is what I want to do.... IF I have an image_id1 in the database please show it. other than that please show me the TBC.jpg picture. in php/sql how this will be write. thanks sebastien Hi guys,
I have a selection on sentences that I have stored as strings.
They all contain dates in different formats. e.g.
"By Himanshu Singh on 30 July 2014"
"By Marc Shoffman - November 26th 2013, 3:47:09 pm"
"Tue Sep 23, 2014 6:33pm BST"
Is there a way to extract just the date from this and turn it into a standard format. For example dd/mm/yyyy
Many Thanks for any help
Mike
I want to find the first sentence in a string without counting decimals. Here is the code I have, but I still want it to display the decimals, but I don't want it to count as the end of a sentence. $content = "This is my test string which is 3.5% of what I'm trying to do. This is only a test."; Code: [Select] function first_sentence($content) { if(preg_match('/[0-9]+\.[0-9]/', $content, $num)) { $number = "$num[0]"; $content = ereg_replace("$number","", $content); } preg_match('/^.*[^\s](\.|\?|\!)/U', $content, $match); $string = $match[0]; $title_count = strlen($match[0]); if($title_count > "6"){ return "$match[0]"; } else { $content2 = ereg_replace("$match[0]","", $content); preg_match('/^.*[^\s](\.|\?|\!)/U', $content2, $step); return "$match[0] $step[0]"; }} Currently this is what it displays: This is my test string which is % of what I'm trying to do. This is what I want it to display: This is my test string which is 3.5% of what I'm trying to do. I have a sentence of say English litriture, i'm after splitting it into words, but the commas (and such, :, are to be treat as a word them selves, i.e. so I can know where they are. Full stops / periods can be ignore since previously split on them. $keywords = preg_split("/[\s]+/", $content); |