473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how can i restrict the first character in PHP string?

like user have to type "A" for the first character in the blank bar,so how can i restrict the "A" for the first character in php string?

Thank you
Sep 21 '07 #1
4 1574
pbmods
5,821 Expert 4TB
Heya, Cyberlei. Welcome to TSDN!

Something like this?
Expand|Select|Wrap|Line Numbers
  1. $str[0] = 'A';
  2.  
Sep 21 '07 #2
Heya, Cyberlei. Welcome to TSDN!

Something like this?
Expand|Select|Wrap|Line Numbers
  1. $str[0] = 'A';
  2.  
something like this:
Expand|Select|Wrap|Line Numbers
  1.  if($sn<>"" $str[0] = 'A';)
  2.     {
  3.         $q = "update remotestatus set step=8 where ip='$ip'";
  4.         mysql_query($q)or die(mysql_error()) ;
  5.         $step=8;
  6.     }
  7.     else
  8.     $message="Number Must Be Start With A";
  9.         }
  10.  
Sep 21 '07 #3
bergy
89
This should work

[php]
if(substr($str, 0, 1) == "A"){
//string okay
}else{
//string not okay :(
}
[/php]
Sep 22 '07 #4
This should work

[php]
if(substr($str, 0, 1) == "A"){
//string okay
}else{
//string not okay :(
}
[/php]

Working well.

Thanks a lot
Oct 11 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Onfrek | last post by:
Hi! I'm playing with entry again and trying to restrict length of entry widget to certain number of character, so users cannot enter more character into it. Any ideas? Reg. Michael Onfrek
28
by: gc | last post by:
Hi, What is the purpose of the restrict keyword? gc
4
by: Vijay Kumar R Zanvar | last post by:
Greetings, Are the following inferences of mine correct? 1. #include <string.h> char *strcpy(char * restrict s1, const char * restrict s2); a. s1 != s2 b. That means,
7
by: tweak | last post by:
Can someone give me a short example as how to best use this keyword in your code? This is my understanding: by definition restrict sounds like it is suppose to restrict access to memory...
12
by: Me | last post by:
I'm trying to wrap my head around the wording but from what I think the standard says: 1. it's impossible to swap a restrict pointer with another pointer, i.e. int a = 1, b = 2; int *...
21
by: Niu Xiao | last post by:
I see a lot of use in function declarations, such as size_t fread(void* restrict ptr, size_t size, size_t nobj, FILE* restrict fp); but what does the keyword 'restrict' mean? there is no...
2
by: den 2005 | last post by:
Hi everybody, How do restrict entering these characters <>\"%';()& and telling user these caharcters are not allowed to be enter in the textbox field using RegularExpression Validator? I put in...
5
by: Dakrat | last post by:
Allow me to preface this post by saying that this is my first database project, and while I have learned a lot, any concepts I have learned are hit and miss as I have found new requirements and...
23
by: raashid bhatt | last post by:
what is restrict keyword used for? eg int *restrict p;
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.