Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
Hello I have an array in PHP when I print it it is like that :
["Testing","Test2","New Testing Activity","The last five letters in the alphabet"]
is there a way to make the array like that :
{"Testing","Test2","New Testing Activity","The last five letters in the alphabet"}
I want this '{' instead of '['
Thanks
Maybe you want to do:
echo '{"' . implode('","', $arr) . '"}';
Demo: http://phpfiddle.org/lite/code/p57-0u4
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I was wondering if you can change the colour of your print and echo text so that when it is displayed on your HTML page it's not simply in black? Cheers.
If you're doing this in html, always.
<?php echo "<span style='color:blue;'>blue text</span>"; ?>
If you're doing this in command line, it's a bit different. You'd need to create a library or find an existing one. Example: http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
Sure :
<?php
echo "<p style='color:blue'> Hello ! </p>";
?>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I need to search word like 'Galaxy S Duos' using search keyword 'galaxysduos'. Kindly provide me the solution in PHP Mysql Query.
SELECT * FROM yourTable WHERE REPLACE(fieldname," ","")="galaxysduos"
try this added some modifiction of #Hanky's answer
SELECT * FROM `yout_table` WHERE LOWER(REPLACE(`your_field`," ",""))="galaxysduos"
OR
SELECT * FROM `yout_table` WHERE REPLACE(LOWER(`your_field`)," ","")="galaxysduos"
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I need a method that concatenate string with enter. As an example my string "Apple", "Box".
That string needs to be as:
$mynewstring = "Apple
Box"
Not as:
$mynewstring ="Apple "."\n"."Box" or $mynewstring ="Apple "."<br>"."Box"
Please tell how to do this.
Just do like this..
<?php
$mynewstring = "Apple,Box";
$arr=explode(",",$mynewstring);
echo(implode(PHP_EOL,$arr));
OUTPUT :
Apple
Box
If your variable is a part of DOM(browser related operation), then consider using <br/>, and use \n if using with php CLI.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
Is there any way that I can get o identify characters like(trademark, superscripts, numbers) from text or text file(but these characters are't in HTML code) and replace them using php
Example:
Get from text: ™ replace with PHP: (TM)
Yes, just parse your strings with str_replace.
Note that str_replace can use arrays, so you can replace multiple strings at once:
$text = "Text™®";
$text = str_replace(['™', '®'], ['(TM)', '(R)'], $text);
print $text;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
i want to check following by function preg_match:
1)Arabic letters
2)English letters
3)numbers
4)spaces, dashes ( - ) and single quotes ( ' )
i use php language
i tried
preg_match("~^[a-z\-'\s]{1,60}$~i", $nam)
You can use this character class : \p{Arabic}
Example:
preg_match("~^[a-z\-'\s\p{Arabic}]{1,60}$~iu", $nam)
strings are treated as utf8 with the \u modifier