Questions tagged [ucfirst]

ucfirst, short for 'Upper Case First', is a function which replaces the first letter of words in a string by their uppercase equivalent.

ucfirst (short for Upper Case First is a function for making a string's first character uppercase. For more details, see the PHP manual page.

35 questions
1
vote
2 answers

First character upper case and ignore few special characters in php

I am trying to dispaly upper case text to just the first character to be upper case in a phrase. If there are any special characters they have to be ignored. for example: SECTION 1: IDENTIFICATION OF THE SUBSTANCE/PREPARATION AND OF THE …
Mohan Prasad
  • 682
  • 1
  • 9
  • 34
1
vote
2 answers

array_push - befuddled with Zend test example

While studying for Zend test, I ran across this code which works, but I cannot figure out why given the two strange props in array_push. strtolower and ucfirst are used where there should be variables. Have I missed some documentation?
Tim Spencer
  • 131
  • 7
1
vote
2 answers

ucfirst after comma separated value

I have the value like admin,bli I have used this code to make the first letter capital And my result is Admin,bli My expected output is Admin,Bli How can I achieve this without using explode function and a for loop?
user2598136
1
vote
1 answer

uppercase first letter of each words (utf8) in MySQL

EDIT: Adding CHARSET utf8 to input param and output make it works. i found this code snippet to convert first letter of every words to uppercase DELIMITER $$ CREATE FUNCTION CAP_FIRST (INPUT VARCHAR(255) CHARSET utf8) RETURNS VARCHAR(255) CHARSET…
Tuan Anh Tran
  • 139
  • 3
  • 9
1
vote
3 answers

how to uppercase only first in zend form inputs?

I am working with Zend Form, and on the edit i want the values to be like ucfirst(values) ;. I found filters 'filters' => array('StringToUpper') but they work on the hole input. Any idea ? Thanks
t.c
  • 1,255
  • 1
  • 16
  • 36
0
votes
0 answers

echo ucfirst tag name

on my website I want to display all tags associated with a post. here is my code :
mmdwc
  • 1,095
  • 6
  • 27
  • 53
0
votes
1 answer

Making the first letter of every sentence upper case using ucfirst

I'm trying to make the first letter of every sentence to be upper case while keeping the punctuation marks. I have tried ucfirst, but it only makes the first letter of the string uppercase, and not every other sentences. How do I fix this? $text =…
jessica
  • 1,667
  • 1
  • 17
  • 35
0
votes
1 answer

ucfirst() not working properly with scandinavic characters

How to get ucfirst() working with scandinavic characters? $str = "SÄKYLÄ"; echo ucfirst(strtolower($str)); //prints SÄkylÄ One possibility is use mb_convert_case() but I'd like to know if this is possible using ucfirst() $str = "SÄKYLÄ"; echo…
lingo
  • 1,848
  • 6
  • 28
  • 56
0
votes
1 answer

why the php ucfirst error, why?

@see: (on mac os): developer:php $ php -v PHP 5.5.24 (cli) (built: Apr 27 2015 11:18:18) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies developer:php $ php -r "echo ucfirst('the test') .…
Ryan
  • 1
  • 1
0
votes
3 answers

Changing to first upper case letter when the first character is a number

I've done this in the past but no longer have what I wrote and can't remember how I did it previously. In correcting some user input, say "THIS IS AN ITEM" to "This is an item", I of course use ucfirst(strtolower($text)) however it's no use when…
Tomate
  • 308
  • 1
  • 2
  • 14
0
votes
2 answers

majuscle to the first character of the custom post title on wordpress

I try to capitalize the first character of a custom post title on wordpress I found this solution here: uppercase issue for title in wordpress here is the code : it…
0
votes
3 answers

Regex in PHP to find last upcase char from the Camel Case

I want to match in PHP the last capitalize (http://php.net/manual/en/function.ucfirst.php) character in the string. To add to the complication I want to ignore everything after a different string, e.g. a sequence of uppercases that not capitalized…
Ragen Dazs
  • 2,115
  • 3
  • 28
  • 56
0
votes
2 answers

Using ucfirst() function in php 5.3 returning a parse error

I'm trying to add a ucfirst() function in my codeigniter controller so I'll get back a string with a first upper case letter. For some reason I keep getting a parse error: Parse error: syntax error, unexpected '(', expecting ',' or ';' in ... on…
Lior Elrom
  • 19,660
  • 16
  • 80
  • 92
0
votes
3 answers

More than one function on one variable

I want to write something in the database, but before I want to delete all spaces in the string and upper the first letter. That's how I wanted to do it but it doesnt work :P //INITIALIZATION OF VARIABLE $perfectFirstname $perfectFirstname =…
Nubu
  • 29
  • 3
0
votes
4 answers

Capitalize first letter in

$item = 'some goes
and
can be placed some words, and then more can exist'; How do I capitalize the first letter of the first word inside ... only?
Jasper
  • 5,090
  • 11
  • 34
  • 41