Jump to content

explode bug


lipun4u

Recommended Posts

why this code gives me error ??

 

<?php
//header("Content-Type: Text/plain");
$name="asit"
print_r(explode(" ", "$name is an asshole"));
?>

 

you have $name inside the quote, you need to change it for

explode(" ", $name." is an asshole");
?>

 

 

Link to comment
Share on other sites

another method for: Explode

 

   //header("Content-Type: Text/plain");
$name="Thisname! Is an asshole";
$z=explode("!", $name);
echo "$z[0] $z[1]!";

 

We're using ! as the unique character

$z[0] being before ! $z[1] being after !

Link to comment
Share on other sites

another method for: Explode

 

   //header("Content-Type: Text/plain");
$name="Thisname! Is an asshole";
$z=explode("!", $name);
echo "$z[0] $z[1]!";

 

We're using ! as the unique character

$z[0] being before ! $z[1] being after !

 

How does that help him at all?

Link to comment
Share on other sites

Obviously its showing him how to use more of the explode function

he probably at one point wants to know how to display the data.

without it looking like this:

Array ( [0] => asit [1] => is [2] => an [3] => asshole ) 

i was just showing him more functionality in the explode call.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.