Formatting a number with leading zeros in PHP

Formatting a number with leading zeros in PHP

I have a variable which contains the value 1234567.I would like it to contain exactly 8 digits, i.e. 01234567.Is there a PHP function for that? 1:Use sprintf :sprintf('%08d', 1234567);Alternatively you can also use str_pad:str_pad($value

Why would a JavaScript variable start with a dollar sign?

Why would a JavaScript variable start with a dollar sign?

I quite often see JavaScript with variables that start with a dollar sign. When/why would you choose to prefix a variable in this way?(I'm not asking about $('p.foo') syntax that you see in jQuery and others, but normal variables like $name

Strict Standards: Only variables should be passed by reference

Strict Standards: Only variables should be passed by reference

$el = array_shift($instance->find(..))The above code somehow reports the strict standars warning,but this will not:function get_arr(){ return array(1,2);}$el = array_shift(get_arr());So when will it report the warning anyway? 1:Consid

What is the difference between JSF, Servlet and JSP?

What is the difference between JSF, Servlet and JSP?

How are JSP and Servlet related to each other? Is JSP some kind of Servlet? How are JSP and JSF related to each other? Is JSF some kind of prebuild UI based JSP like ASP.NET-MVC? 1:JSP (JavaServer Pages)JSP is a Java view technology runn

How to configure XAMPP to send mail from localhost?

How to configure XAMPP to send mail from localhost?

I am trying to send mail from localhost.but i am unable to send the mail from localhostso can anybody tell me that how to reconfigure my xampp to send mail from localhost 1:You can send mail from localhost with sendmail package , sendma

How to get the input element triggering the jQuery autocomplete widget?

How to get the input element triggering the jQuery autocomplete widget?

I have several input fields that are enhanced with jQuery auto-complete functionality. How to get the corresponding input field when a select event is triggered?$('input[type=text]').autocomplete({ source: 'suggestions.php', select: f

PHP Convert String into Float/Double

PHP Convert String into Float/Double

I have list of string (size in bytes), I read those from file. Let say one of the string is 2968789218, but when I convert it to float it become 2.00.This is my code so far :$string = "2968789218";$float = (float)$string;//$float = floatval

Codeigniter unset session

Codeigniter unset session

Hi I have a site develop in CodeIgniter.In one of my page I'm using pagination of CodeIgniter after a search form.In this case I store into my session the search value passed by $_POST because if I have more result clicking the next page th

Is there any way to integrate OpenCV with PHP?

Is there any way to integrate OpenCV with PHP?

I am trying to develop an application with PHP.There are two possible ways this application will be developed. The first one is to try to do something like www.picnik.com, image processing directly on the browser.The other is to develop CBI

date() method, “A non well formed numeric value encountered” does not want to format a date passed i

date() method, “A non well formed numeric value encountered” does not want to format a date passed i

I unfortunately can't use DateTime() as the server this project is on is running PHP v.5.2.the line in question:$aptnDate2 = date('Y-m-d', $_POST['nextAppointmentDate']); throws the following error:Notice: A non well formed numeric value en

checkbox jquery or javascript oncheck?

checkbox jquery or javascript oncheck?

I do not know the correct terminology for this, but I want the same effect as onclick but for a check box with jquery or javascript.onclick version:LinkI want the same effect as above but for a checkbox. The end result will be that the page

Why does PHP have a $ sign in front of variables? [closed]

Why does PHP have a $ sign in front of variables? [closed]

In PHP and some other scripting languages have the $var syntax while Java and other languages we can do just var. Is there any theory behind it? Does it help them to parse. If not why would they choose to tack on an extra character in front

What is the default stack size in Node.js?

What is the default stack size in Node.js?

I know how to set the stack size thanks to:How can I increase the maximum call stack size in Node.jsBut, what is the default size? (ie how do I get to the PHP equivalent of phpinfo()) 1:The simple answer is that the default stack size i

How do I get the project basepath in CodeIgniter

How do I get the project basepath in CodeIgniter

I have created a folder as user in the root directory.My project base path is:/var/www/myproject/When I want to access the base path as BASEPATH from a controller it's showing:/var/www/myproject/system/ But I want the path to be:/var/www/my

new mysqli vs mysqli_connect [closed]

new mysqli vs mysqli_connect [closed]

What is difference between the new mysqli and mysqli_connect?I know that executing a query is different;for example: mysqli->query() and mysqli_query()Why are there two different types, what is the need for the difference? 1:One is for P

Print all variables available in a Smarty template

Print all variables available in a Smarty template

How do you print all variables available in the context of a Smarty template? Something like the Django debug trace that lists everything being passed.Thanks 1:Use {debug} From the manual: {debug} dumps the debug console to the page. T

Add sql table column before or after specific other column - by migrations in Laravel 4.1

Add sql table column before or after specific other column - by migrations in Laravel 4.1

Table 'users':|id|name|address|post_code|deleted_at|created_at|and I want add column 'phone_nr' somewhere between 'id' and 'deleted_at'Is it possible by migrations in Laravel 4.1? 1:Yes. Create a new migration using php artisan migrate:

What's a good PHP Active Record library? [closed]

What's a good PHP Active Record library? [closed]

I've been using CodeIgniter for some quite time, and I've been extremely happy with its Active Record stuff. It's great to query the database with it.Recently I've started a new project and I can't use such a framework anymore.Is there a si

Calling other function in the same controller?

Calling other function in the same controller?

I'm using Laravel. Here is a class I'm working on:The line:return sendRequest($uri);Renders the error:Call to undefined function sendRequest()I'm assuming it's because I'm referencing the function in the wrong manner, but I can't find any e

How to get user agent in PHP

How to get user agent in PHP

I'm using this JS code to know what browser is user using for. And I want to get this navigator.appName to php code to use it like this:if ($appName == "Internet Explorer") { // blabla}How can I do it? 1:Use the native PHP $_SERVER['HT

Android App Development and Web Server Interactions

Android App Development and Web Server Interactions

I am just learning about Android Development so excuse me if this is a bit off in nature.I am wanting to make an app that interacts with a Database from my website, in a sense the two things will be one feeding the other. So with that. I am

polymer form using paper-input and core-ajax

polymer form using paper-input and core-ajax

i am working on a custom element that will serve as a form for sending map node data to a database using a restful service. i have 3 questions about this element.can this even work? i am trying to use a method which seems exactly the opposi

How to Have Search Engines Index Database-Driven Content?

How to Have Search Engines Index Database-Driven Content?

How can I make it so that content from a database is available to search engines, like google, for indexing?Example:Table in mysql has a field named 'Headline' which equals 'BMW M3 2005'.My site name is 'MySite'User enters 'BMW M3 2005 MySi

secure sessions/cookies in php

secure sessions/cookies in php

I have a question about sessions. How do you make a secure login session/cookie.I was looking at this example where they add this array to the session:$data = array{ username = $_POST['username']; is_logged = true;}I was wondering if

JQuery UI Autocomplete with Zend Framework

JQuery UI Autocomplete with Zend Framework

I was wondering about how to add the autocomplete JQuery UI widget to a form I'm developing in the Zend Framework without using ZendX. The folders for the website are set up per the framework, but I'm not using Zend_Form.So I stripped every