Sometimes we write a logic to show comma separated data. But the challenge is not to append comma to the last value.
We can do this by using next() function:
<?php
$arr = array('tvs','hero','honda','bajaj');
$copy = $arr;
foreach ($arr as $val) {
echo $val;
if (next($copy )) {
echo ','; // Add comma for all elements instead of last
}
}
?>
code{
background: #f9f9f9;...
Saturday, 10 January 2015
Facebook
Twitter
Google+
GitHub
Stackoverflow
RSS
Popular Posts
-
How to read image using jquery & html5 File reader API is used to read a file from your local hard drive We can find Atricle ...
-
Jquery code to add extra field using jquery. Demo HTML PART : <div class='extdiv'> <input type...
-
A simple jquery filter ..! Usage: Here my requirement is to search users by category (ex: music director and singer). By using this ...
-
A simple Flask Redis Tutorial Install requirements : flask, redis Install virtual environment: sudo apt-get install python3-v...
-
Remember the traditional method of calling $(document).ready() ? <script> $(document).ready(function(){ // Code Goes Hear }); ...
-
Simple shell script to clone your flask app , installing requirements, activating virtual environment and running the application. ...
-
Sometimes we write a logic to show comma separated data. But the challenge is not to append comma to the last value. We can do this by us...
-
Another jQuery filter by click event Usage: Here my requirement is i need to search users by using their category(ex: music director and s...
-
Submit a form without submit button and javascript submit We mostly prefer php form submit either using javascript or normal submit. ...
Blog Archive
About Me
Powered by Blogger.