<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC4%2FPHP-String-Functions-Part-2%2FEnglish</id>
		<title>PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=PHP-and-MySQL%2FC4%2FPHP-String-Functions-Part-2%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&amp;action=history"/>
		<updated>2026-05-13T01:24:41Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&amp;diff=890&amp;oldid=prev</id>
		<title>Pravin1389: moved PHP-and-MySQL/C4/PHP-String-Functions-(Part 2)/English to PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&amp;diff=890&amp;oldid=prev"/>
				<updated>2012-12-01T15:40:35Z</updated>
		
		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/index.php/PHP-and-MySQL/C4/PHP-String-Functions-(Part_2)/English&quot; class=&quot;mw-redirect&quot; title=&quot;PHP-and-MySQL/C4/PHP-String-Functions-(Part 2)/English&quot;&gt;PHP-and-MySQL/C4/PHP-String-Functions-(Part 2)/English&lt;/a&gt; to &lt;a href=&quot;/index.php/PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&quot; title=&quot;PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&quot;&gt;PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&lt;/a&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;tr style='vertical-align: top;'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:40, 1 December 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Pravin1389</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&amp;diff=587&amp;oldid=prev</id>
		<title>Chandrika: Created page with '{|Border=1 !Time !Narration |- |0:00 |Ok back to the second part of the String Functions tutorial. |- |0:03 |I'm going to go through the rest of the functions starting from Strin…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=PHP-and-MySQL/C4/PHP-String-Functions-Part-2/English&amp;diff=587&amp;oldid=prev"/>
				<updated>2012-11-29T07:02:04Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{|Border=1 !Time !Narration |- |0:00 |Ok back to the second part of the String Functions tutorial. |- |0:03 |I&amp;#039;m going to go through the rest of the functions starting from Strin…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{|Border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Ok back to the second part of the String Functions tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|0:03&lt;br /&gt;
|I'm going to go through the rest of the functions starting from String Reverse.&lt;br /&gt;
|-&lt;br /&gt;
|0:08&lt;br /&gt;
|String reverse probably to make sense is s-t-r-rev.&lt;br /&gt;
|-&lt;br /&gt;
|0:11&lt;br /&gt;
|So what strvev does is it reverses the contents of a string.&lt;br /&gt;
|-&lt;br /&gt;
|0:20&lt;br /&gt;
|So if I were to say 'Hello' and I were to reverse that, it would be &amp;quot;o-l-l-e-H&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|0:30&lt;br /&gt;
|And it can be useful in some circumstances although you usually wouldn't use this.&lt;br /&gt;
|-&lt;br /&gt;
|0:36&lt;br /&gt;
|But you could use this function if you want to specifically reverse a string.&lt;br /&gt;
|-&lt;br /&gt;
|0:41&lt;br /&gt;
|I think its a useful and fun function to use.&lt;br /&gt;
|-&lt;br /&gt;
|0:45&lt;br /&gt;
|Ok - the next set of functions I have grouped together are these: str to lower and str to upper.&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
|This basically means string to lower case and string to upper case.&lt;br /&gt;
|-&lt;br /&gt;
|0:58&lt;br /&gt;
|So if we have our string that equals 'HELLO', I can say echo str to lower and show the value of the string in there.&lt;br /&gt;
|-&lt;br /&gt;
|1:12&lt;br /&gt;
|The 'HELLO' in capitals will now become lowercase.&lt;br /&gt;
|-&lt;br /&gt;
|1:15&lt;br /&gt;
|Something similar would happen if I were to say this is 'hello' in smallcase&lt;br /&gt;
|-&lt;br /&gt;
|1:21&lt;br /&gt;
|And I could say str to upper and that would give me my uppercase version of the string.&lt;br /&gt;
|-&lt;br /&gt;
|1:31&lt;br /&gt;
|Now one applicable use of this is when you have user-registration.&lt;br /&gt;
|-&lt;br /&gt;
|1:35&lt;br /&gt;
|If you have a website on which users have to register, you should usually always store the user name as a lower string.&lt;br /&gt;
|-&lt;br /&gt;
|1:49&lt;br /&gt;
|The reason is that if I submit a user name - lets get rid of this...&lt;br /&gt;
|-&lt;br /&gt;
|1:55&lt;br /&gt;
|Some people actually do this - Lets have a variable user name which equals say 'ALEX'.&lt;br /&gt;
|-&lt;br /&gt;
|2:01&lt;br /&gt;
|And I'll put in these also - uppercase and smallcase alphabets.&lt;br /&gt;
|-&lt;br /&gt;
|2:07&lt;br /&gt;
|Some people use names like this to  make the name look funky and its perfectly okay.&lt;br /&gt;
|-&lt;br /&gt;
|2:13&lt;br /&gt;
|But if the name is stored as this and you think - well did i start with a small a?  &lt;br /&gt;
|-&lt;br /&gt;
|2:19&lt;br /&gt;
|Then I have another pattern for username now.&lt;br /&gt;
|-&lt;br /&gt;
|2:23&lt;br /&gt;
|So what you can do is say stored user name equals to str to lower of the username.&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|So this would be the stored username in the database &lt;br /&gt;
|-&lt;br /&gt;
|2:33&lt;br /&gt;
|Now when they go to login and type in their username in this combination, what we would do is we would convert their typed-in login username to lower case and compare it to the lower case store version of the username.&lt;br /&gt;
|-&lt;br /&gt;
|2:48&lt;br /&gt;
|So we are taking this and storing a lowercase value inside the database and we are comparing it to a typed-in value which has also been converted to lower case&lt;br /&gt;
|-&lt;br /&gt;
|2:58&lt;br /&gt;
|Hence we can't go wrong and users are not going to forget their user-names.&lt;br /&gt;
|-&lt;br /&gt;
|3:07&lt;br /&gt;
|You could do the same with passwords.&lt;br /&gt;
|-&lt;br /&gt;
|3:14&lt;br /&gt;
|Ok lets go to the next one. &lt;br /&gt;
|-&lt;br /&gt;
|3:22&lt;br /&gt;
|Sub-string count. This would basically count the no. of sub-strings matching to a particular value inside a string.&lt;br /&gt;
|-&lt;br /&gt;
|3:31&lt;br /&gt;
|So here I'll type search equals &amp;quot;My name is alex. What is your name?&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|3:37&lt;br /&gt;
|So this is our string.&lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|Now if I say we need to echo out the sub-string count...&lt;br /&gt;
|-&lt;br /&gt;
|3:49&lt;br /&gt;
|and obviously this stands for sub-string-count, what we want to do is, we want to search our 'search' string...&lt;br /&gt;
|-&lt;br /&gt;
|4:01&lt;br /&gt;
|and we will specify a string to search for.  Now this will return an integer if we put this in a variable called result.&lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|That's because you can't find any instance of a word which will appear say for 1.2 times.&lt;br /&gt;
|-&lt;br /&gt;
|4:20&lt;br /&gt;
|Also the variable result will not return 2 as t-w-o.  It will only return 2 as an integer.&lt;br /&gt;
|-&lt;br /&gt;
|4:30&lt;br /&gt;
|So this is quite useful if we are using substring count to search for, lets say, 'alex'.&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
|And then it will echo out on its own.&lt;br /&gt;
|-&lt;br /&gt;
|4:39&lt;br /&gt;
|And if you look through here, you will see there is only one instance of 'alex'&lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
|So refresh that - and we should get the number 1.&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|Now if we were to search for 'name' - there's 1 instance of 'name' here and another instance of 'name' here &lt;br /&gt;
|-&lt;br /&gt;
|4:52&lt;br /&gt;
|So when we refresh, we should get the value 2.&lt;br /&gt;
|-&lt;br /&gt;
|4:55&lt;br /&gt;
|Now there are optional parameters for this, which are 'where to start from in a string' and 'where to end in a string'.&lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|Lets try this out.&lt;br /&gt;
|-&lt;br /&gt;
|5:05&lt;br /&gt;
|So lets say I want to search from after name, ok?&lt;br /&gt;
|-&lt;br /&gt;
|5:11&lt;br /&gt;
|So this is 0 1 2 3 4 5 6.&lt;br /&gt;
|-&lt;br /&gt;
|5:14&lt;br /&gt;
|So I say search name from 7 onwards.&lt;br /&gt;
|-&lt;br /&gt;
|5:19&lt;br /&gt;
|So search name from 7 and it will search in this blue area that I have highlighted here.&lt;br /&gt;
|-&lt;br /&gt;
|5:25&lt;br /&gt;
|It will only return 1 in the result.&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|So you can specify whereabouts in the string.&lt;br /&gt;
|-&lt;br /&gt;
|5:30&lt;br /&gt;
|I think you can specify upto where.  &lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|So this is 7... 8 9 10 11 12 13 14 15 16. &lt;br /&gt;
|-&lt;br /&gt;
|5:43&lt;br /&gt;
|7 to 17.  Lets check if this works.&lt;br /&gt;
|-&lt;br /&gt;
|5:46&lt;br /&gt;
|It shows zero.  So from 7 to 17 - which is from about here to here - we find zero instances of 'name'. &lt;br /&gt;
|-&lt;br /&gt;
|5:55&lt;br /&gt;
|However if we search for 'alex', we will find 1 instance of it.&lt;br /&gt;
|-&lt;br /&gt;
|6:01&lt;br /&gt;
|Ok - so that's the substring count function.&lt;br /&gt;
|-&lt;br /&gt;
|6:07&lt;br /&gt;
|And now substring replace is similar.&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|Its not the same function but it includes an added bonus where you can replace your string.&lt;br /&gt;
|-&lt;br /&gt;
|6:18&lt;br /&gt;
|So the replace tags are - My name is alex and I've added the full-stop on purpose.&lt;br /&gt;
|-&lt;br /&gt;
|6:28&lt;br /&gt;
|Our result is equal to substring replace.&lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
|What do I want to replace in? I want to replace in the variable replace.&lt;br /&gt;
|-&lt;br /&gt;
|6:41&lt;br /&gt;
|And I want to replace 'alex' with 'billy'.&lt;br /&gt;
|-&lt;br /&gt;
|6:48&lt;br /&gt;
|And this will be from - let me count 0 1 2 3 4 5  7 8 9 10 11 so from 11 until...&lt;br /&gt;
|-&lt;br /&gt;
|7:01&lt;br /&gt;
|Its 11 - 0 1 2 3 4 5 6 7 8 9 10 11  - from 11 to 14. &lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|So that should replace 'alex' with 'billy'.&lt;br /&gt;
|-&lt;br /&gt;
|7:19&lt;br /&gt;
|Replace and refresh.&lt;br /&gt;
|-&lt;br /&gt;
|7:21&lt;br /&gt;
|Oh! We didn't echo out result.&lt;br /&gt;
|-&lt;br /&gt;
|7:23&lt;br /&gt;
|Lets echo out result and we can refresh this.&lt;br /&gt;
|-&lt;br /&gt;
|7:26&lt;br /&gt;
|And it should return my name is billy.&lt;br /&gt;
|-&lt;br /&gt;
|7:30&lt;br /&gt;
|This should be 12 and this 15, I think.&lt;br /&gt;
|-&lt;br /&gt;
|7:34&lt;br /&gt;
|Or in fact no - it should be 10 and 14.&lt;br /&gt;
|-&lt;br /&gt;
|7:38&lt;br /&gt;
|No, not quite right.... We are missing the full-stop.&lt;br /&gt;
|-&lt;br /&gt;
|7:43&lt;br /&gt;
|........ so lets go for 11 and 14.&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
|Still missing the full stop and I cant think why.&lt;br /&gt;
|-&lt;br /&gt;
|7:52&lt;br /&gt;
|aah! well you get the picture&lt;br /&gt;
|-&lt;br /&gt;
|7:55&lt;br /&gt;
|Basically you can replace anything in the string with the starting value and the ending value &lt;br /&gt;
|-&lt;br /&gt;
|7:59&lt;br /&gt;
|It will leave it up to you to count through.&lt;br /&gt;
|-&lt;br /&gt;
|8:04&lt;br /&gt;
|I'm very tired so I am not able to count.&lt;br /&gt;
|-&lt;br /&gt;
|8:09&lt;br /&gt;
|So what we are doing here is we are replacing a particular string with a particular value&lt;br /&gt;
|-&lt;br /&gt;
|8:14&lt;br /&gt;
|And here's your starting value and here's your finishing value.&lt;br /&gt;
|-&lt;br /&gt;
|8:17&lt;br /&gt;
|That's all in this tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|8:19&lt;br /&gt;
|There are many more string functions and I suggest you to search, may be, on 'google'.&lt;br /&gt;
|-&lt;br /&gt;
|8:24&lt;br /&gt;
|Search for 'php string functions' and you'll find a lot of interesting functions.&lt;br /&gt;
|-&lt;br /&gt;
|8:28&lt;br /&gt;
|If you are looking to do a particular thing there's probably a function available for it.&lt;br /&gt;
|-&lt;br /&gt;
|8:33&lt;br /&gt;
|Thanks for watching!  This is Osama Butt dubbing for the Spoken Tutorial Project.&lt;/div&gt;</summary>
		<author><name>Chandrika</name></author>	</entry>

	</feed>