cms
|
codepad
|
|
cms
|
Saved pastes by cms:
<?
$date1 = strtotime('2009-01-01');
$date2 = strtotime('2010-01-01');
while ($date1 <= $date2) {
|
view (8 lines, 13 lines of output) |
<?
$jsonString = '[{"name":"john","id":5932725006},{"name":"max","id":4953467146}]';
echo preg_replace('/("\w+"):(\d+)/', '\\1:"\\2"', $jsonString);
|
view (4 lines, 1 line of output) |
<?
$jsonString = '[{"name":"john","id":5932725006},{"name":"max","id":4953467146}]';
echo preg_replace("/(\d+)/", '"\\1"', $jsonString);
|
view (4 lines, 1 line of output) |
(let ((l '((4 3 1) (5 6 8))))
(write (list-ref l 0)) ; get the element at index 0
)
(let ((l '((4 3 1) (5 6 8))))
|
view (7 lines, 1 line of output) |
<?
$jsonString = '[{"id":1,"name":"Test nameu","phone":"214748364723432432"},{"id":2,"name":"Next name","phone":3774387}]';
$decoded = json_decode($jsonString);
foreach ($decoded as $obj) {
|
view (10 lines, 2 lines of output) |
<?
$jsonString = '[{"id":1,"name":"Test nameu","phone":"214748364723432432"},{"id":2,"name":"Next name","phone":3774387}]';
$decoded = json_decode($jsonString);
foreach ($decoded as $obj) {
|
view (11 lines, 2 lines of output) |
<?
$string = 'test1, test2, test3, test4,';
$string = substr($string, 0, -1);
$array = explode(',', $string);
var_dump($array);
|
view (5 lines, 10 lines of output) |
<?
$string = 'test1, test2, test3, test4,';
//$string = substr($string, 0, -1);
var_dump(explode(',', $string));
|
view (4 lines, 12 lines of output) |
<?
function urlFriendly($title)
{
$title = preg_replace(array('/[^\w\s]/i', '/\s+/i'), array('','-'), $title);
|
view (10 lines, 1 line of output) |