best practice to make string int and check if string is not int

I have the following code:
<?php

function s2int($pinned_id) {
$action=”aaa”;
if ( $action && is_numeric($pinned_id) && (float)$pinned_id==(int)$pinned_id) {
/**
* @param [string] $action is setted
* @param [int/string as int] $pinned_id is setted
*/
echo “-chekpoint- $pinned_id\n”;
$pinned_id = (int)$pinned_id;
}
else { echo “-passpoint- $pinned_id\n”;}
return $pinned_id;
}

echo s2int(“000010″).”\n”;
echo s2int(10.00001).”\n”;
echo [...]

In PHP, how to check how much memory a certain loop is using

I’m currently making a PHP timer that checks how much time a certain way of doing something takes compared to another thing that accomplishes the same, basically benchmarking.
Now, I would also like to make this tool be able to tell how much memory that specific way of doing it is taking up.
So, for more info, [...]

reference error:jw player is not defined

I’m showing the jw player inside the thickbox and calling the jwplayer code through ajax. When I call it, it is showing the thickbox without jwplayer and Error console showing the reference error “jwplayer is not defined” error.I’m using the jquery 1.8 .When I call it 2nd time without page refresh it is showing the [...]

Is there an algorithm to output all possible combinations of two sets of elements?

I am writing an application in PHP where users can enter two sets of information and have every possible combination of the two sets printed out. The goal is to use it as a teaching tool for learning language by practicing different patterns of a question and answer.
For example, we may practice the question [...]

Jquery submit is not post anything

I have a form and I want to use jQuery to change the action of it and post it to another php.
Here is what I did…It keeps telling me im not posting anything…which I did submit the form and post it.
My script:
<script>
function facebook(){
$(“#first-form”).attr(“action”, “/yiiauth/default/authenticatewithfacebook”);
$(‘#first-form’).submit();
}

function gmail(){
$(“#first-form”).attr(“action”, “/yiiauth/default/authenticatewithgoogle”);
$(‘#first-form’).submit();
}
</script>

My php to process this form:
public [...]

Library to write PHP web service for android consumption

I need to write a service in PHP. The server will be used by android/iphone clients through the url for example like this
http://www.myservice.com/query.php?param1=a&param2=2…

The server will return data back
The client will push data to server
There can be large num of clients simultaneously accessing so the performance is key

I want to use the data format [...]

POST javascript into mysql database

I am trying to get this to put the data into the database. Adcode can be javascript…etc thus the real_escape, but it will not put it in the databse.. the adname works, but the $ad doesnt.
// Insert ad into database
$ad = mysql_real_escape_string($_POST['adcode']);
$insert = “INSERT INTO ads (adname, adcode) VALUES (‘”.$_POST['adname'].”‘, ‘”.$_POST['$ad'].”‘)”;
$doit = mysql_query($insert);

thanks for the [...]

Upload Image without Page Refresh & then Display Image

I have a button that allows a user to select an image – shown below:
<div id=”fileUpload”>
<form id=”joinPhotoUploadForm” method=”POST” enctype=”multipart/form-data”>
<input type=”file” id=”file”/>
[...]

Nginx is returning 404 when setting a variable

I’m using Nginx to serve a Drupal site and with Boost.
So far it’s been working fine, but recently we added a mobile version and i configured boost/drupal to cache the mobile version in another directory, however i’m triying to configure Nginx to check for the adecuate directory if the device is mobile, but i’m getting [...]

Best Practices Passing In A Limited Amount Of Variable Values Into Method

I am creating a class for Contact management and I am curious if anyone has any creative ideas to pass in options to make certain columns sortable via ORDER BY in MySQL.
There are 5 columns. ID, Firstname, Lasname, Phone Number, Email.
All of these will need to be sortable Ascending and Descending. The obvious [...]

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories